Discussions

Ask a Question
Back to All

oneOf rendered as pulldown in API Reference

Our OAS has "oneOf" objects specified in component schemas, similar to the example below. Although they render correctly in Swagger Editor, they don't appear to render correctly in API Reference in Staging. Specifically, instead of the objects being rendered, a pulldown with two options "Option1" and "Option2" is rendered. Selecting an option from the pulldown does not result in any action.

My expectation is that both of the objects would be rendered with a notation indicating "oneOf", or a pulldown with the objects' descriptions would be rendered and the objects would be rendered when selected from the pulldown. Is there something wrong with our spec that is preventing the expected behavior?

openapi: 3.0.1
info:
  title: foo
  version: "1.0"
paths:
  /pets:
    post:
      summary:  Posts a pet
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
      responses:
        '200':
          description: Updated
components:
  schemas:
    Pet:
      type: object
      oneOf:
        - type: object
          properties:
            catInfo:
              $ref: '#/components/schemas/Cat'
        - type: object
          properties:
            dogInfo:
              $ref: '#/components/schemas/Dog'
    Dog:     
      properties:
        bark:
          type: boolean
        breed:
          type: string
          enum: [Dingo, Husky, Retriever, Shepherd]
    Cat:
      properties:
        hunts:
          type: boolean
        age:
          type: integer