openapi: 3.0.0
info:
  title: ACME
  version: 1.0.0

paths:
  /pets:
    get:
      operationId: listPets
      responses:
        "200":
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/Dog"
                  - $ref: "#/components/schemas/Cat"
                  - $ref: "#/components/schemas/Rabbit"
                  - $ref: "#/components/schemas/Fox"

components:
  schemas:
    Dog:
      type: object
      properties:
        name:
          type: string
        breed:
          type: object
          oneOf:
            - $ref: "#/components/schemas/Breed1"
            - $ref: "#/components/schemas/Breed2"
            - $ref: "#/components/schemas/Breed3"

    Breed1:
      type: object
      properties:
        name:
          type: string
    Breed2:
      type: object
      properties:
        name:
          type: string
    Breed3:
      type: object
      properties:
        name:
          type: string

    Cat:
      type: object
      properties:
        name:
          type: string

    Rabbit:
      type: object
      properties:
        name:
          type: string

    Fox:
      type: object
      properties:
        name:
          type: string
        breed:
          oneOf:
            - enum:
                - BROWN_1
                - BROWN_2
              title: Brown types
              type: string
            - enum:
                - DARK_BROWN_1
                - DARK_BROWN_2
              title: Dark brown types
              type: string
