openapi: 3.0.0
info:
  title: all-of Models
  description: Model composition using all-of
  version: 1.0.0
paths:
  /all-of/employee:
    get:
      summary: List of employees
      responses:
        "200":
          description: Checkout the model tab to view object schemas defined using all-of
          content:
            application/json:
              schema:
                type: object
                $ref: "#/components/schemas/emp1"
components:
  schemas:
    emp1:
      type: object
      additionalProperties: false
      description: Employee Details
      allOf:
        - properties:
            Id:
              type: string
              description: Employee ID
        - $ref: "#/components/schemas/name"
        - $ref: "#/components/schemas/job"
    emp2:
      type: object
      additionalProperties: false
      properties:
        Employee:
          description: Employee Details
          allOf:
            - properties:
                Id:
                  type: string
                  description: Employee ID
            - $ref: "#/components/schemas/name"
            - $ref: "#/components/schemas/job"
    name:
      type: object
      additionalProperties: false
      properties:
        firstName:
          type: string
          description: First name
        lastName:
          type: string
          description: Last Name
    job:
      type: object
      additionalProperties: false
      properties:
        jobTitle:
          type: string
          description: Job title
        department:
          type: string
          description: Department name