-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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][Go] UnmarshalJson has unused variable err if spec has oneOf without discriminator #7961
Comments
I've filed #8069 to fix the issue. |
As per the change, if Expected: In the absence of openapi-generator/modules/openapi-generator/src/main/resources/go/model_oneof.mustache Line 54 in 67c3d56
|
Good point. I'll see what I can do. |
Suggest to have this PR #11178 |
Bug Report Checklist
Description
In the openAPI spec, if a schema has
oneOf
but does not have adiscriminator
and the configuseOneOfDiscriminatorLookup
is set toTrue
, the unmarshalJson function is incorrectly generated. Such a scenario can arise when the schema looks as follows:Considering the fact that there are other schemas in this spec that may have
oneOf
withouttype: 'null'
, the configurationuseOneOfDiscriminatorLookup: True
is required. As a result, the unmarshal function for the above object is as follows:Building this generates an error because the variable
err
is declared but not used.openapi-generator version
Master build with last commit id 023e6dd
Suggest a fix
Allow unmarshalling of data even if no
discriminator
is mentioned whenuseOneOfDiscriminatorLookup: True
The text was updated successfully, but these errors were encountered: