openapi_enum_patch 0.2.0 copy "openapi_enum_patch: ^0.2.0" to clipboard
openapi_enum_patch: ^0.2.0 copied to clipboard

Give real names to the integer enums swagger_parser generates from OpenAPI, fill in the enum files it skips, and audit which enums still need naming.

Changelog #

0.2.0 #

  • Added the reorganize command: groups the flat models swagger_parser emits into per-namespace folders, routes enums into an enums/ subfolder, and strips the now-redundant namespace prefix from type names — rewriting every relative import, part directive, model URI and type reference across your sources. Cross-service name collisions keep their prefix so the result still compiles. Idempotent.
  • Namespace groups are derived from the schema keys via RegistryBuilder.namespacePrefixes, so nothing has to be hard-coded; pass groups to reorganizeModels to override.
  • Breaking: the --config and --overrides defaults are now swagger_parser.yaml and enum_overrides.yaml at the project root, instead of paths under a swagger_tools/ folder. Pass -c / -o if your files live elsewhere.

0.1.0 #

Initial release.

  • patch command — synthesises the enum files swagger_parser skips for query-parameter-only enums, and applies enum_overrides.yaml to the rest.
  • normalize command — rewrites {version} path templates to a concrete version and qualifies bare components.schemas names with a namespace prefix, rewriting every matching $ref. Both passes are idempotent.
  • audit command — reports integer enums with no override, overrides that do not name every value, and overrides naming values the schema dropped.
  • --strict makes a non-clean audit exit non-zero, for CI.
  • Library API — RegistryBuilder, EnumAuditor, SchemaNormalizer, EnumPatcher — with an EnumEmitter interface for non-dart_mappable back-ends.
  • Emitted compute helpers use the dart_mappable mapper API (XMapper.fromValue, toValue()), which works when enums_to_json: false.
1
likes
160
points
342
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Give real names to the integer enums swagger_parser generates from OpenAPI, fill in the enum files it skips, and audit which enums still need naming.

Repository (GitHub)
View/report issues

Topics

#openapi #swagger #codegen #enums

License

MIT (license)

Dependencies

args, meta, path, yaml

More

Packages that depend on openapi_enum_patch