Skip to content

Duplicated schemas in parsed result #1081

@ackintosh

Description

@ackintosh

Related issue: OpenAPITools/openapi-generator#2701


Specs that reproduces the issue

  • openapi.yaml
openapi: 3.0.0
info:
  title: Common Data Types
  version: "1.0"
paths:
  /subscriptions:
    get:
      summary: read all of the active subscriptions for the app.
      operationId: getSubscriptionsById
      parameters:
        - name: appId
          in: path
          description: App ID
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: OK (Successful)
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Subscription'
        '500':
          $ref: './common.yaml#/components/responses/E500'  
components:
  schemas:
      ProblemDetails:
        type: object
        properties:
          title:
            type: string
            description: A short, human-readable summary of the problem
          status:
            type: integer
            description: The HTTP status code for this occurrence of the problem.
      Subscription:
        type: string
  • common.yaml
openapi: 3.0.0
info:
  title: Common Data Types
  version: "1.0"
paths: {}
components:
  responses:
    E500:
      description: Server Error
      content:
        application/json:
          schema:
            $ref: './openapi.yaml#/components/schemas/ProblemDetails'

Test codes which shows the issue

  • OpenAPIV3ParserTest.java
    @Test
    public void fooBar() {
        String location = "src/test/resources/xxx/openapi.yaml";
        OpenAPIV3Parser parser = new OpenAPIV3Parser();

        OpenAPI result = parser.read(location);
    }

The result has a duplicated schema ProblemDetails_2.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions