-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[Bug][Java] jaxrs-cxf-client missing annotation when generating Enum #5077
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
Comments
Similar behavior occurs when enum name is defined in camel-case and during code generation it gets value for the original name used in api and name in upper case. When this is (de)serialized it does not use this value but name instead. Can be fixed also with Currently the only workaround seems to be to override the enumOuterClass.mustache file locally with the said annotation in place |
@arnis87 Can you please provide an example? Thanks! |
Hmm, This was some time ago and do not remember exact details but something like this:
This is then generated into java:
Notice that the value for the java enum is same as in the json definition and name is all caps. However when request is made filling the object with enum |
Is this bug solved yet? If yes, which release has it? |
Description
Integer Enums are generated with missing @JsonCreator annotation and causing InvalidFormatException while deserialization.
The Enum is defined for values {1, 2, 3} but the deserialization is trying to work with the index, so it is wrong for values 1 and 2 and fails for value 3.
openapi-generator version
4.2.2
OpenAPI declaration file content or url
yaml file:
generated java code:
Command line used for generation
Gradle task:
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Adding @JsonCreator annotation to generated fromValue() method:
The text was updated successfully, but these errors were encountered: