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
100 stars 47 forks source link

How to make a list of nullable items? #68

Closed mleevi closed 1 year ago

mleevi commented 1 year ago

I want to return an array of a type, that can also contain null values. But even if I set "nullable": true in the items the generated list always contains non-null type.

E.g. In the example Pets api if I change findPets response from:

 "items": {
    "$ref": "#/components/schemas/Pet"
 }

to:

"items": {
    "nullable": true,
    "$ref": "#/components/schemas/Pet"
}

Even then the resulting code is the same List<Pet> instead of List<Pet?>

mleevi commented 1 year ago

I made a change that seems to fix the issue: https://github.com/Carapacik/swagger_parser/compare/main...mleevi:swagger_parser:main

Carapacik commented 1 year ago

Thanks