Skip to content
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

Fixed wrong clearing of CodegenModel#hasEnum field #11653

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

kthoms
Copy link
Contributor

@kthoms kthoms commented Feb 18, 2022

A CodegenModel's hasEnum property is set in addVars:
cm.hasEnums = true;
This state was cleared afterwards again.

As one of its results the import for @JsonValue was not added for the model class in the Spring code generator, where 'model.hasEnums' was evaluated to false where it should be true.

Added a test case with the model provided in the issue that reproduces the problem.

To fix #11323

A CodegenModel's hasEnum property is set in addVars:
  cm.hasEnums = true;
This state was cleared afterwards again.

As one of its results the import for @JsonValue was not added for the model class in the Spring code generator, where 'model.hasEnums' was evaluated to false where it should be true.
@wing328
Copy link
Member

wing328 commented Feb 21, 2022

cc @OpenAPITools/generator-core-team

@wing328
Copy link
Member

wing328 commented Feb 21, 2022

Tested locally to confirm the fix.

@wing328 wing328 merged commit 735dae4 into OpenAPITools:master Feb 21, 2022
@wing328
Copy link
Member

wing328 commented Feb 21, 2022

@kthoms thanks for the PR, which has been merged into the master.

@wing328 wing328 changed the title [#11323] Fixed wrong clearing of CodegenModel#hasEnum field Fixed wrong clearing of CodegenModel#hasEnum field Feb 21, 2022
@kthoms kthoms deleted the issues/11323 branch February 21, 2022 15:56
@kthoms
Copy link
Contributor Author

kthoms commented Feb 21, 2022

Glad that I could help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][JAVA][SPRING] missing JsonValue import if allOf used as inline-scheme composition
2 participants