-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Required values is nullable #324
Comments
Hi @mohachouch It's expected behaviour for this moment. We generating all required fields nullable. It's needed to have ability to use these models as request parameters, because (at least on our project) we should not send required fields sometimes. I already have idea how to fix. We will generate separate models for Responses, and such models will have not-nullable fields |
Thank you very much for your response and this wonderful work |
I would suggest keeping it open to not forget to fix it when we will have two separate models fro request and responses |
Hey @Vovanella95, any chance we can get the non-nullable required values (implemented vide #282)? |
Hi @samarth-ramesh , I will try to implement it in a week or two |
Ooo, Tysm |
@samarth-ramesh please let us know in case of issues. I have checked it on my swaggers but who knows :D |
Works now, thanks a lot :) |
I'm still getting nullable everything in all models created. How do I get it to just respect the swagger file and make any field without a nullable: true not nullable? |
@jhancock4d please share example of swagger |
Thank you very much for this library
Describe the bug
Required value in swager file is nullable when generating.
To Reproduce
"BrowserInfoPostDto": {
"required": [
"acceptHeader",
"colorDepth",
"javaEnabled",
"javascriptEnabled",
"language",
"timeZoneOffset",
"userAgent"
],
"type": "object",
"properties": {
"acceptHeader": {
"type": "string"
},
"javaEnabled": {
"type": "boolean"
},
"javascriptEnabled": {
"type": "boolean"
},
"language": {
"type": "string"
},
"colorDepth": {
"type": "integer",
"format": "int32"
},
"screenHeight": {
"type": "integer",
"format": "int32"
},
"screenWidth": {
"type": "integer",
"format": "int32"
},
"timeZoneOffset": {
"type": "string"
},
"userAgent": {
"type": "string"
}
},
Output
@jsonkey(name: 'acceptHeader')
final String? acceptHeader;
@jsonkey(name: 'javaEnabled')
final bool? javaEnabled;
@jsonkey(name: 'javascriptEnabled')
final bool? javascriptEnabled;
@jsonkey(name: 'language')
final String? language;
@jsonkey(name: 'colorDepth')
final int? colorDepth;
@jsonkey(name: 'screenHeight')
final int? screenHeight;
@jsonkey(name: 'screenWidth')
final int? screenWidth;
@jsonkey(name: 'timeZoneOffset')
final String? timeZoneOffset;
@jsonkey(name: 'userAgent')
final String? userAgent;
Expected behavior
@jsonkey(name: 'acceptHeader')
final String acceptHeader;
@jsonkey(name: 'javaEnabled')
final bool javaEnabled;
@jsonkey(name: 'javascriptEnabled')
final bool javascriptEnabled;
@jsonkey(name: 'language')
final String language;
@jsonkey(name: 'colorDepth')
final int colorDepth;
@jsonkey(name: 'screenHeight')
final int? screenHeight;
@jsonkey(name: 'screenWidth')
final int? screenWidth;
@jsonkey(name: 'timeZoneOffset')
final String timeZoneOffset;
@jsonkey(name: 'userAgent')
final String userAgent;
Thank you very much for your help
The text was updated successfully, but these errors were encountered: