-
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
Enum maps in swagger.g.dart are missing 'enums.' prefix to correctly point at imported enums #188
Comments
Hi @point-source , json_serializable file with .g postfix should not know about enums. We add @jsonkey(fromJson: customMethod) for enum properties. If it not happend - please share swagger file with error and I will fix generator. |
Here is the swagger file: https://gist.github.com/point-source/06bf4559145ecd01a2d806df61895b81 |
I'm having a similar issue where enums defined in the swagger file are mentioned the In this example, I have a schema
The When a new schema is created for
This could be a workaround for some cases, but it would be great if it could handle both cases. |
This issue is affecting the Plaid spec as well: https://github.com/plaid/plaid-openapi/blob/master/2020-09-14.yml Tested with the 2.0.9 branch. |
I will check it |
@point-source could you please confirm that issue was reproduced with the latest 2.0.8 version? |
@fryette Unfortunately, when I try to build with 2.0.8 I encounter this error:
which I believe is because 2.0.8 (at least) does not handle this type: "ytd_earnings": {
"allOf": [
{
"$ref": "#/components/schemas/PaystubYTDDetails"
}
]
} So I manually removed that property as a test and it did build though the original enum related issue remains the same. Hopefully that helps. Let me know if there's anything else I can do. |
Ok let me see. I've fixed next swagger file Anything else to fix in this issue? |
Awesome! Thank you so much. I can test this in about an hour. |
@point-source test it from branch for now. Tomorrow I will release it to pub.dev. just need to test changes a bit |
Yep, this appears fixed in the 2.0.8_plus branch. Thanks! |
api_name.swagger.dart file contains these lines:
and when referencing an enum in this same file (notice the preceding
enums.
):but the part file api_name.swagger.g.dart attempts to access them this way:
This gives the following errors:
By manually adding
enums.
preceding each MyEnum reference, the errors are corrected. Am I missing a build option / flag or is this incorrectly generated the swagger.g.dart enum map code?My working code looks like this:
Unfortunately, there are far too many references for me to do this by hand. And besides, if this is a real bug, we should fix it at the source. Thanks in advance!
The text was updated successfully, but these errors were encountered: