openapi: 3.0.1
info:
  title: example
  version: 1.0.0
paths:
  /test:
    get:
      responses:
        200:
          description: successful operation
components:
  schemas:
    Animal:
      type: object
      properties:
        weight:
          type: number
        hasLegs:
          type: boolean
      discriminator:
        propertyName: animalType
      required:
        - animalType
        - hasLegs
    Pet:
      allOf:
        - $ref: "#/components/schemas/Animal"
        - type: object
          properties:
            name:
              type: string