Complete OpenAPI 3.0/3.1 generation, diagnostics, lifecycle safety, enum and naming mappings, bilingual documentation, examples, and pub.dev release validation.
34 lines
1.0 KiB
Markdown
34 lines
1.0 KiB
Markdown
# Koi Swagger Parser example
|
|
|
|
This directory contains a small, self-contained OpenAPI 3.0 document and two
|
|
ways to generate Dart sources from it.
|
|
|
|
## Use the Dart API
|
|
|
|
From the package root, run:
|
|
|
|
```shell
|
|
dart run example/koi_swagger_parser_example.dart
|
|
```
|
|
|
|
The program writes generated files to a temporary directory, prints a summary,
|
|
and removes the directory in a `finally` block.
|
|
|
|
## Use the command-line interface
|
|
|
|
The included configuration writes output to `example/generated`:
|
|
|
|
```shell
|
|
dart run koi_swagger_parser generate \
|
|
--config example/koi_swagger_parser.yaml
|
|
```
|
|
|
|
Applications that compile the generated sources must add the packages used by
|
|
their selected generator preset, such as Dio, Retrofit, Freezed, and their
|
|
associated code generators. Run `build_runner` in the consuming application
|
|
after generation when Freezed or JSON serialization output is required.
|
|
|
|
The example configuration disables `build_runner` so that the generator itself
|
|
can be demonstrated without adding those application dependencies to this
|
|
package.
|