Carapacik / swagger_parser

Dart package that takes an OpenApi definition file and generates REST clients based on retrofit and data classes for your project.
https://pub.dev/packages/swagger_parser
MIT License
97 stars 45 forks source link

Type names not being Pascal Case #223

Closed mikewolfd closed 4 months ago

mikewolfd commented 5 months ago

Steps to reproduce

Having schemes keys that are not PascalCase.

In the open_api_parser.dart y'all use a processed "type" value as a key on an untransformed schema map.

You should either keep some flat key dictionary or use the same transformations on the map, or at least throw an error if there are non-PascalCase keys there.

Expected results

Runs successfully.

Actual results

` type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast

0 OpenApiParser.parseRestClients.parametersV3 (package:swagger_parser/src/parser/parser/open_api_parser.dart:356:45)`

Your OpenApi snippet

`{ ..., components: { ..., schemas: { ..., UserJWTPair: {...}}}

Dart version and used packages versions

Dart SDK version: 3.3.3 (stable) (Tue Mar 26 14:21:33 2024 +0000) on "macos_x64"

swagger_parser: ^1.17.2

StarProxima commented 4 months ago

@mikewolfd Hi, this should be fixed in the latest version, can you test it with your examples?