openapi: 3.0.1
info:
  version: 1.0.0
  title: Example
  license:
    name: MIT
servers:
  - url: http://api.example.xyz/v1
paths:
  /person/display/{personId}:
    get:
      parameters:
        - name: personId
          in: path
          required: true
          description: The id of the person to retrieve
          schema:
            type: string
      operationId: list
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Person"
components:
  schemas:
    Person:
      description: person using x-parent (abstract) to indicate it's a parent class
      type: object
      x-parent: "abstract"
      properties:
        $_type:
          type: string
        lastName:
          type: string
        firstName:
          type: string
    Adult:
      description: A representation of an adult
      allOf:
      - $ref: '#/components/schemas/Person'
      - type: object
        properties:
          children:
            type: array
            items:
              $ref: "#/components/schemas/Child"
    Child:
      description: A representation of a child
      allOf:
      - type: object
        properties:
          age:
            type: integer
            format: int32
      - $ref: '#/components/schemas/Person'
    AnotherChild:
      description: another child class that does NOT extend/inherit AnotherPerson
      allOf:
        - type: object
          properties:
            age:
              type: integer
              format: int32
        - $ref: '#/components/schemas/AnotherPerson'
    AnotherPerson:
      description: person object without x-parent extension
      type: object
      allOf:
        - properties:
            $_type:
              type: string
            lastName:
              type: string
            firstName:
              type: string
        - $ref: '#/components/schemas/AnotherParent'
    AnotherParent:
      description: parent object without x-parent extension
      type: object
      properties:
        isParent:
          type: boolean
        mum_or_dad:
          type: string
    allOfWithProperties:
      description: parent object without x-parent extension
      type: object
      allOf:
        - $ref: '#/components/schemas/AnotherParent'
      properties:
        isParent:
          type: boolean
        mum_or_dad:
          type: string
      required:
        - isParent