Skip to content

Fix outer enum generation on jaxrs-resteasy-eap#1427

Open
GabriRuflex wants to merge 1 commit into
swagger-api:masterfrom
GabriRuflex:fix-outer-enum-resteasy-eap
Open

Fix outer enum generation on jaxrs-resteasy-eap#1427
GabriRuflex wants to merge 1 commit into
swagger-api:masterfrom
GabriRuflex:fix-outer-enum-resteasy-eap

Conversation

@GabriRuflex

@GabriRuflex GabriRuflex commented Jul 19, 2026

Copy link
Copy Markdown

Description of the PR

Top-level (outer) enums generated by jaxrs-resteasy-eap currently 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:

OrderStatus:
  type: string
  enum: [placed, approved, delivered]

The sibling jaxrs-resteasy template (handlebars/JavaJaxRS/resteasy/enumOuterClass.mustache) was already fixed at some point — this PR aligns the eap template with it.

Notably, JavaResteasyEapServerCodegen already adds the com.fasterxml.jackson.annotation.JsonValue import for outer enum models in postProcessModelsEnum, 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-annotated toString(), same as the plain resteasy template
  • resteasy/enumOuterClass.mustache: remove a stray o.O typo in the javadoc opening that ends up verbatim in every generated outer enum
  • Added a regression test (JavaResteasyOuterEnumCodegenTest) covering both jaxrs-resteasy and jaxrs-resteasy-eap; it fails on current master for jaxrs-resteasy-eap and 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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant