Open tototo23 opened 4 months ago
Hi @tototo23 , I am encountering the same issue. I tried digging into the code of this library. I found that this library is largely a wrapper for https://github.com/OpenAPITools/openapi-generator
So I opened this issue to notify that repository of this issue
Description of the bug
In my OpenAPI yaml file i've been given, a schema describes :
Meaning that : none of my fields are required, and non of the fields in the JSON of the request can be null. In other words, only fields that are set will be in the json, the unset fields will not be in the JSON object.
But using this
yaml
file, withGenerator.dart
, i'm given :I'm suposed to not have the
else
section, if the field this.nameis null, because it's not nullable (in JSON side) and not required.Steps to reproduce
Use an openAPI yaml file with the above case, example :
Generate the API code with this yaml file withthe command
flutter pub run build_runner build --delete-conflicting-outputs
, for example having somewhere :Expected behavior
If 'name' is null in my dart side, it should mean it is not set. And as this fields is not required and not nullable, the JSON result should not get "else ..=null", but just :
Logs
No response
Screenshots
No response
Platform
Windows
Library version
5.0.2
Flutter version
3.16.9
Flutter channel
stable
Additional context