-
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] Properties marked nullable in swagger file are not nullable in generated output #506
Comments
Hi! I have the same problem starting from version 2.8.4... By the moment, i rollback to version 2.8.3 |
@point-source Could you please share swagger of |
@aledavidgueva could you please share Your swagger file? |
@Vovanella95 I did. It's right there where it says "Link to Swagger/OpenApi documentation". But here's another link just in case: https://raw.githubusercontent.com/plaid/plaid-openapi/master/2020-09-14.yml I just converted it to json with a yaml to json converter online. |
@point-source cool, will take a look! |
I fixed the first part of this bug here: point-source@cee0a10 As best I can tell, the second example in my post is failing because referenced models which have a nullable flag are not marked nullable. Line 684 of swagger_models_generator.dart should be handling this but the |
@point-source will you be able to provide a pull request with a fix? |
Sadly not. I was only able to fix the first issue but not the second. I don't understand this library well enough to close the entire ticket. I can still open a PR though if you want to pull in the bit that I did do. Perhaps with some guidance on where to look I can help with the rest? |
Is there any other way I can help with this? |
@point-source sorry no updates for now. Will take a look into it this week. Thanks for patience! |
Describe the bug
I have a property on line 18748 of this swagger file like so:
The generated output for this property is:
For reference, this is part of the AccountBalance model:
When I try to deserialize the server response, it fails because Null is not a subtype of num.
Expected behavior
The generated output should allow the limit property (and other properties marked null) to be null.
Swagger specification link
Link to swagger/OpenApi documentation
Library version used:
master branch on commit b9ecb61 (v2.8.7)
Additional Info:
I suspect the issue might be on this line:
..isNullable = (json[kIsNullable] ?? json[kIsNullable] ?? false) as bool;
It appears to me like the intention was to handle both "x-nullable" and "nullable" cases but accidentally is checking "x-nullable" twice.
Patching this results in this output:
While this fixes the case that started this ticket, it did not fix a similar issue with the component on line 18570 as references from line 43202:
Reference to the component:
The text was updated successfully, but these errors were encountered: