Skip to content

Commit 7f99a76

Browse files
committed
docs: added migration notice to docs
1 parent 51d3683 commit 7f99a76

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

README.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ Annotate a dart class with @Openapi() annotation
7474
7575
```dart
7676
@Openapi(
77-
additionalProperties:
78-
AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'),
79-
inputSpecFile: 'example/openapi-spec.yaml',
80-
generatorName: Generator.dart,
81-
outputDirectory: 'api/petstore_api')
82-
class Example {}
77+
additionalProperties:
78+
DioProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep..'),
79+
inputSpec:
80+
RemoteSpec(path: 'https://petstore3.swagger.io/api/v3/openapi.json'),
81+
typeMappings: {'Pet': 'ExamplePet'},
82+
generatorName: Generator.dio,
83+
runSourceGenOnOutput: true,
84+
outputDirectory: 'api/petstore_api',
85+
)
8386
```
8487

8588
Run
@@ -99,7 +102,8 @@ The api sdk will be generated in the folder specified in the annotation. See exa
99102

100103
## Next Generation
101104

102-
There is some new functionality slated to be added to the generator. This version will have the ability to:
105+
As of version 5.0 of this library, there is some new functionality slated to be added to the generator. This version
106+
will have the ability to:
103107

104108
- cache changes in the OAS spec
105109
- Rerun when there ares difference in the cached copy and current copy
@@ -118,25 +122,18 @@ New:
118122

119123
```dart
120124
@Openapi(
121-
additionalProperties:
122-
AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'),
123-
inputSpecFile: 'example/openapi-spec.yaml',
124-
generatorName: Generator.dart,
125-
outputDirectory: 'api/petstore_api',
126-
cachePath: 'some/preferred/directory/cache.json',
127-
useNextGen: true
125+
additionalProperties:
126+
DioProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep..'),
127+
inputSpec:
128+
RemoteSpec(path: 'https://petstore3.swagger.io/api/v3/openapi.json'),
129+
typeMappings: {'Pet': 'ExamplePet'},
130+
generatorName: Generator.dio,
131+
runSourceGenOnOutput: true,
132+
outputDirectory: 'api/petstore_api',
128133
)
129134
class Example {}
130135
```
131136

132-
**IMPORTANT** With the new changes comes 2 new annotation properties:
133-
134-
- useNextGen (boolean)
135-
- Default: `false`
136-
- cachePath (String)
137-
- Default: `.dart_tool/openapi-generator-cache.json`
138-
- Must be a path to a `json` file.
139-
- Can only be set when `useNextGen` is `true`
140137

141138
## Contributing
142139

example/api/petstore_api/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ environment:
77
sdk: '>=2.15.0 <3.0.0'
88

99
dependencies:
10-
dio: '^5.0.0'
10+
dio: '^5.2.0'
1111
one_of: '>=1.5.0 <2.0.0'
1212
one_of_serializer: '>=1.5.0 <2.0.0'
1313
built_value: '>=8.4.0 <9.0.0'

example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Openapi Generator last run: : 2023-10-01T09:26:15.827402
1+
// Openapi Generator last run: : 2024-01-16T01:49:21.940229
22
import 'package:flutter/material.dart';
33
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';
44

@@ -124,4 +124,4 @@ class _MyHomePageState extends State<MyHomePage> {
124124
), // This trailing comma makes auto-formatting nicer for build methods.
125125
);
126126
}
127-
}
127+
}

0 commit comments

Comments
 (0)