openapi: 3.0.3
info:
  title: Airport Manager authorization microservice
  description: Airport Manager authorization microservice
  version: 1.0.0
servers:
  - url: "{scheme}://{server}:{port}"
    description: my server
    variables:
      scheme:
        default: http
        enum:
          - http
          - https
      server:
        default: localhost
      port:
        default: "${server.port}"
paths:
  /api/users/{id}:
    get:
      tags:
        - User
      summary: Get user by id.
      description: Returns an object representing an user.
      operationId: getUserById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDto'
        "404":
          description: Not Found
    put:
      tags:
        - User
      summary: Update user by id.
      description: Update a user
      operationId: updateUserById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreationUserDto'
        "404":
          description: Not Found
    delete:
      tags:
        - User
      summary: Delete user by id.
      description: delete a user
      operationId: deleteUserById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
        "404":
          description: Not Found

components:
  schemas:
    DomainEntity:
      title: Domain Entity
      description: Represents a Domain Entity
      type: object
      required:
        - id
      properties:
        id:
          type: integer
          description: unique id
          format: int64
          example: 1
      discriminator:
        propertyName: objectType
    UserDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntity'
      type: object
      title: Steward
      description: Represents a steward on a flight.
      required:
        - id
        - firstName
        - lastName
      properties:
        firstName:
          type: string
          description: first name of a the user
          example: John
        lastName:
          type: string
          description: last name of a user
          example: Doe
    CreationUserDto:
      type: object
      title: User
      description: Represents a user.
      properties:
        firstName:
          type: string
          description: first name of a the user
          example: John
          required: true
        lastName:
          type: string
          description: last name of a user
          example: Doe
          required: true