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

Same name for all models defined inline for responses #44

Open
ashwini-desai opened this issue Sep 18, 2020 · 0 comments
Open

Same name for all models defined inline for responses #44

ashwini-desai opened this issue Sep 18, 2020 · 0 comments

Comments

@ashwini-desai
Copy link
Collaborator

Problem:
For paths with more than one inline response schema defined, names for all models are generated the same.
Eg:

/pets:
    post:
      summary: Create pets
      operationId: createPets
      tags:
        - pets
      requestBody:
        description: 'Create pets'
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                required:
                  - id
                  - name
                properties:
                  id:
                    type: integer
                    format: int64
                  name:
                    type: string
                  tags:
                    type: array
                    items:
                      type: string
        required: true
      responses:
        '200':
          description: list of pets created
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  required:
                    - id
                    - name
                  properties:
                    id:
                      type: integer
                      format: int64
                    name:
                      type: string
                    tags:
                      type: array
                      items:
                        type: string
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                  message:
                    type: string

In this path above, two models for responses are generated - one of type kotlin.collections.List<ShowByPetIdResponse> and another of type ShowByPetIdResponse.

Tech notes:
Currently the only mandatory field which can help us differentiate responses are the http statuses(200, 300..etc) or default.

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

No branches or pull requests

1 participant