Skip to content

oneOf not on root is not shown in json samples #715

Open
@albertored

Description

@albertored

I'm using version 2.0.0.rc41

When a response consists of a schema with some oneOf elements not at root level only the first possibility is shown on json sample panel.

openapi: 3.0.0
info:
  version: '1.0'
  title: Test
security: []
paths:
  '/test':
    post:
      operationId: test
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/S'
components:
  schemas:
    S:
      type: object
      properties:
        p1:
          oneOf:
            - $ref: '#/components/schemas/S1'
            - $ref: '#/components/schemas/S2'
    S1:
      type: string
    S2:
      type: integer

screenshot from 2018-11-16 13-45-04

If instead the oneOf element is at the root of the response the json sample correctly shows the switching schema buttons.

openapi: 3.0.0
info:
  version: '1.0'
  title: Test
security: []
paths:
  '/test':
    post:
      operationId: test
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                 oneOf:
                  - $ref: '#/components/schemas/S1'
                  - $ref: '#/components/schemas/S2'
components:
  schemas:
    S1:
      type: string
    S2:
      type: integer

screenshot from 2018-11-16 13-48-19

Metadata

Metadata

Assignees

No one assigned

    Labels

    openapiQuestions about specification, validity, and edge cases

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions