Skip to content

Fixed wrong clearing of CodegenModel#hasEnum field#11653

Merged
wing328 merged 1 commit intoOpenAPITools:masterfrom
kthoms:issues/11323
Feb 21, 2022
Merged

Fixed wrong clearing of CodegenModel#hasEnum field#11653
wing328 merged 1 commit intoOpenAPITools:masterfrom
kthoms:issues/11323

Conversation

@kthoms
Copy link
Copy Markdown
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
Copy Markdown
Member

wing328 commented Feb 21, 2022

cc @OpenAPITools/generator-core-team

@wing328
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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