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

jaxrs-resteasy: fix outer enum case #139

Merged
merged 1 commit into from
May 24, 2018
Merged

jaxrs-resteasy: fix outer enum case #139

merged 1 commit into from
May 24, 2018

Conversation

jmini
Copy link
Member

@jmini jmini commented May 24, 2018

With the jaxrs-resteasy generator, this PR fixes the outer-class enum case.

Example OAS3:

openapi: 3.0.1
info:
  title: ping test
  version: '1.0'
servers:
  - url: 'http://localhost:8000/'
paths:
  /ping:
    get:
      operationId: pingGet
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjWithEnums'

components:
  schemas:
    ObjWithEnums:
      type: object
      properties:
        SProp:
            $ref: "#/components/schemas/StringEnum"

    StringEnum:
      type: string
      enum:
        - "c"
        - "b"
        - "a"

@jmini
Copy link
Member Author

jmini commented May 24, 2018

Without the change, the generated code does not compile. After the fix, the diff looks like this:

diff --git a/openapi-generator-utils/treepots/treepots-openapigen-jaxrs-resteasy/src/gen/java/org/openapitools/model/StringEnum.java b/openapi-generator-utils/treepots/treepots-openapigen-jaxrs-resteasy/src/gen/java/org/openapitools/model/StringEnum.java
index 24701bf..27243c0 100644
--- a/src/gen/java/org/openapitools/model/StringEnum.java
+++ b/src/gen/java/org/openapitools/model/StringEnum.java
@@ -5,5 +5,5 @@ import java.util.ArrayList;
 import com.fasterxml.jackson.annotation.JsonValue;
 import javax.validation.constraints.*;
 public enum StringEnum {
-    {values=[c, b, a], enumVars=[{name=C, value="c"}, {name=B, value="b"}, {name=A, value="a"}]}
+    C, B, A
 }

@wing328 wing328 added this to the 3.0.0 milestone May 24, 2018
@wing328 wing328 merged commit 072ce07 into master May 24, 2018
@wing328 wing328 deleted the fix_resteasy_enum branch May 24, 2018 16:35
nilskuhn pushed a commit to nilskuhn/openapi-generator that referenced this pull request Apr 6, 2023
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.

None yet

2 participants