Fix outer enum generation on jaxrs-resteasy-eap#1427
Open
GabriRuflex wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the PR
Top-level (outer) enums generated by
jaxrs-resteasy-eapcurrently lose their spec values: the generated enum has no value field and no@JsonValue, so Jackson serializes the Java constant name (PLACED) instead of the wire value (placed), breaking round-tripping with any conforming client. Reproducible with a minimal schema:The sibling
jaxrs-resteasytemplate (handlebars/JavaJaxRS/resteasy/enumOuterClass.mustache) was already fixed at some point — this PR aligns theeaptemplate with it.Notably,
JavaResteasyEapServerCodegenalready adds thecom.fasterxml.jackson.annotation.JsonValueimport for outer enum models inpostProcessModelsEnum, so until now the generated file even carried an unused import: the template was the missing half, and this PR completes it.Changes:
resteasy/eap/enumOuterClass.mustache: generate outer enums with value constructor and@JsonValue-annotatedtoString(), same as the plain resteasy templateresteasy/enumOuterClass.mustache: remove a strayo.Otypo in the javadoc opening that ends up verbatim in every generated outer enumJavaResteasyOuterEnumCodegenTest) covering bothjaxrs-resteasyandjaxrs-resteasy-eap; it fails on current master forjaxrs-resteasy-eapand passes with this PR. The test uses JUnit 4 annotations so it actually runs with the surefire provider configured in the pom.This is the OAS3 counterpart of swagger-api/swagger-codegen#10533 (same fix for the v2 generators, see also #3856 for the original jaxrs-spec issue).
cc @ewaostrowska