openapi: 3.1.0
info:
  title: Polymorphism
  description: 'Polymorphism example'
  contact:
    name: 'Swagger API Team'
  version: '1'
servers:
  -
    url: 'https://example.localhost'
    description: 'API server'
paths:
  /test:
    get:
      tags:
        - api
      description: 'Get test'
      operationId: 2bf08e1a95c02130edf82da5846bfca3
      responses:
        '200':
          description: Polymorphism
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Request'
components:
  schemas:
    Responsible:
      properties:
        type:
          type: string
          enum:
            - employee
            - assignee
            - fl
      type: object
      discriminator:
        propertyName: type
        mapping:
          fl: '#/components/schemas/FlResponsible'
          employee: '#/components/schemas/EmployeeResponsible'
      oneOf:
        -
          $ref: '#/components/schemas/FlResponsible'
        -
          $ref: '#/components/schemas/EmployeeResponsible'
    EmployeeResponsible:
      allOf:
        -
          $ref: '#/components/schemas/Responsible'
        -
          properties:
            property2:
              type: string
            type:
              type: string
              const: Virtual
    FlResponsible:
      allOf:
        -
          $ref: '#/components/schemas/Responsible'
        -
          properties:
            property3:
              type:
                - string
                - 'null'
    Request:
      properties:
        payload:
          $ref: '#/components/schemas/Responsible'
      type: object
tags:
  -
    name: api
    description: 'API operations'
