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

Enum properties are not being serialized correctly #214

Closed
hbelmiro opened this issue Dec 29, 2022 · 0 comments · Fixed by #215
Closed

Enum properties are not being serialized correctly #214

hbelmiro opened this issue Dec 29, 2022 · 0 comments · Fixed by #215
Assignees
Labels
added to backlog The issue was added to backlog bug Something isn't working

Comments

@hbelmiro
Copy link
Contributor

Given the following OpenAPI document:

openapi: 3.0.3
info:
  title: echo
  version: '1.0.0'
  description: ""
paths:
  /echo:
    post:
      summary: Echo
      operationId: echo
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Message"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Echo'
components:
  schemas:
    Echo:
      type: object
      properties:
        echoedMsgType:
          type: string
    Message:
      type: object
      required:
        - msgType
      properties:
        msgType:
          type: string
          enum:
            - 'text'

The msgType property is not serialized correctly and the request is sent with the enum name (TEXT) in the JSON rather than the enum value (text).

      properties:
        msgType:
          type: string
          enum:
            - 'text'

Generated enum:

    public enum MsgTypeEnum {
        TEXT("text");
        ...
@hbelmiro hbelmiro self-assigned this Dec 29, 2022
@hbelmiro hbelmiro added bug Something isn't working added to backlog The issue was added to backlog labels Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added to backlog The issue was added to backlog bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant