---
openapi: "3.1.0"
info:
  title: "Reproducer for issue #112"
  version: 2.0.0
paths:
  /users:
    get:
      summary: Get all users.
      parameters:
        - in: query
          name: role
          required: false
          schema:
            # this is one way to represent nullable types in OpenAPI
            oneOf:
              - type: "string"
                enum: ["admin", "member", "reader"]
              - type: "null"
      responses:
        "200":
          description: A list of all users.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      description: The user ID.
                      type: integer
                    username:
                      description: The user name.
                      type: string
                    deleted:
                      description: Whether the user account has been deleted.
                      type: boolean
                      default: false
  /users/{userID}:
    get:
      summary: Get a user by ID.
      parameters:
        - in: path
          name: userID
          schema:
            type: "string"
      responses:
        "200":
          description: The expected information about a user.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: The user ID.
                    type: integer
                  username:
                    description: The user name.
                    type: string
                  bio:
                    description: A brief bio about the user.
                    # this is another way to represent nullable types in OpenAPI that also demonstrates that assertions are
                    # ignored for different primitive types
                    # https://github.com/OAI/OpenAPI-Specification/issues/3148
                    type: ["string", "null"]
                    maxLength: 255
                  deleted:
                    description: Whether the user account has been deleted.
                    type: boolean
                    default: false
                  created_at:
                    description: The date the user account was created.
                    type: string
                    format: date
                  deleted_at:
                    description: The date the user account was deleted.
                    # this is yet another slightly different way
                    anyOf:
                      - type: string
                        format: date
                      - type: null
