|
1 |
| -A sample command-line application with an entrypoint in `bin/`, library code |
2 |
| -in `lib/`, and example unit test in `test/`. |
| 1 | +Generator library for dart/flutter implementation of openapi client code generation. |
| 2 | +To be used together with [openapi-generator-annotations](https://pub.dev/packages/openapi_generator_annotations) |
3 | 3 |
|
4 |
| -Created from templates made available by Stagehand under a BSD-style |
5 |
| -[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE). |
| 4 | +[license](https://github.com/gibahjoe/openapi-generator-dart/blob/master/openapi-generator-annotations/LICENSE). |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +Include [openapi-generator-annotations](https://pub.dev/packages/openapi_generator_annotations) as a dependency in the dependencies section of your pubspec.yaml file : |
| 9 | + |
| 10 | +```yaml |
| 11 | +dependencies: |
| 12 | + openapi_generator_annotations: ^1.0.0 |
| 13 | +``` |
| 14 | +
|
| 15 | +
|
| 16 | +Add [openapi-generator](https://pub.dev/packages/openapi_generator) in the dev dependencies section of your pubspec.yaml file: |
| 17 | +
|
| 18 | +```cmd |
| 19 | +openapi-generator <command> |
| 20 | +``` |
| 21 | + |
| 22 | + |
| 23 | +Annotate a dart class with @Openapi() annotation |
| 24 | + |
| 25 | +```dart |
| 26 | +@Openapi( |
| 27 | + additionalProperties: |
| 28 | + AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'), |
| 29 | + inputSpecFile: 'example/openapi-spec.yaml', |
| 30 | + generatorName: 'dart-jaguar', |
| 31 | + outputDirectory: 'api/petstore_api') |
| 32 | +class Example extends OpenapiGeneratorConfig {} |
| 33 | +``` |
| 34 | + |
| 35 | +Run |
| 36 | +```cmd |
| 37 | +flutter pub run build_runner build --delete-conflicting-outputs |
| 38 | +``` |
| 39 | +to generate open api client sdk from spec file specified in annotation. |
| 40 | +The api sdk will be generated in the folder specified in the annotation. See examples for more details |
| 41 | + |
| 42 | +## Features and bugs |
| 43 | + |
| 44 | +Please file feature requests and bugs at the [issue tracker][tracker]. |
| 45 | + |
| 46 | +[tracker]: https://github.com/gibahjoe/openapi-generator-dart/issues |
0 commit comments