openapi: 3.0.3
info:
  title: Mock Server API
  description: Mock Server for load testing and reliability proxy validations. Includes unauthorized endpoints and three groups with separate static bearer authorization key.
  version: 1.0.0
servers:
  - url: https://mock.mirapi.io
    description: Mock Server
paths:
  # === No Authorization Group ===
  /anything:
    get:
      summary: Anything endpoint (No Auth)
      description: Returns a simple success JSON payload.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: anything
                  status:
                    type: string
                    example: success
  /sameresponse:
    post:
      summary: Echo request body (No Auth)
      description: Returns the same request body sent by the client.
      requestBody:
        required: true
        content:
          '*/*':
            schema:
              type: string
      responses:
        '200':
          description: Echoed response
  /random:
    get:
      summary: Random outcome (No Auth)
      description: Returns either 200 OK or 502 Bad Gateway randomly.
      responses:
        '200':
          description: Random success
        '502':
          description: Random failure
  /post:
    post:
      summary: Post echo endpoint (No Auth)
      description: Simulates httpbin post, echoing back the JSON body, headers, and request metadata.
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Success
  /echo/get/json:
    get:
      summary: Standard GET echo (No Auth)
      description: Returns a predefined JSON structure.
      responses:
        '200':
          description: Success
  /delay/{seconds}:
    get:
      summary: Delay endpoint (No Auth)
      description: Artificial delay for the specified duration.
      parameters:
        - name: seconds
          in: path
          required: true
          schema:
            type: number
            example: 1.5
      responses:
        '200':
          description: Success
  /status/{code}:
    get:
      summary: Status endpoint (No Auth)
      description: Returns the specified HTTP status code.
      parameters:
        - name: code
          in: path
          required: true
          schema:
            type: integer
            example: 400
      responses:
        'default':
          description: Response with requested status code
  /webhooks/incoming:
    post:
      summary: Incoming Webhook Receiver (No Auth)
      description: Receives and stores a webhook payload under a given 'id' query parameter.
      parameters:
        - name: id
          in: query
          required: false
          schema:
            type: string
            example: test-123
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Success
  /webhooks/inspect:
    get:
      summary: Inspect Webhooks (No Auth)
      description: Returns stored webhooks filtered by 'id' query parameter, or all if empty.
      parameters:
        - name: id
          in: query
          required: false
          schema:
            type: string
            example: test-123
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    timestamp:
                      type: string
                      format: date-time
                    headers:
                      type: object
                    body:
                      type: string
                    method:
                      type: string
  /webhooks/clear:
    post:
      summary: Clear Webhooks (No Auth)
      description: Clears stored webhooks. Filters by 'id' query parameter if provided, otherwise clears all.
      parameters:
        - name: id
          in: query
          required: false
          schema:
            type: string
            example: test-123
      responses:
        '200':
          description: Success

  # === Auth 1 Group ===
  /auth1/anything:
    $ref: '#/components/paths/anythingAuth1'
  /auth1/sameresponse:
    $ref: '#/components/paths/sameresponseAuth1'
  /auth1/random:
    $ref: '#/components/paths/randomAuth1'
  /auth1/post:
    $ref: '#/components/paths/postAuth1'
  /auth1/echo/get/json:
    $ref: '#/components/paths/echoGetJsonAuth1'
  /auth1/delay/{seconds}:
    $ref: '#/components/paths/delayAuth1'
  /auth1/status/{code}:
    $ref: '#/components/paths/statusAuth1'

  # === Auth 2 Group ===
  /auth2/anything:
    $ref: '#/components/paths/anythingAuth2'
  /auth2/sameresponse:
    $ref: '#/components/paths/sameresponseAuth2'
  /auth2/random:
    $ref: '#/components/paths/randomAuth2'
  /auth2/post:
    $ref: '#/components/paths/postAuth2'
  /auth2/echo/get/json:
    $ref: '#/components/paths/echoGetJsonAuth2'
  /auth2/delay/{seconds}:
    $ref: '#/components/paths/delayAuth2'
  /auth2/status/{code}:
    $ref: '#/components/paths/statusAuth2'

  # === Auth 3 Group ===
  /auth3/anything:
    $ref: '#/components/paths/anythingAuth3'
  /auth3/sameresponse:
    $ref: '#/components/paths/sameresponseAuth3'
  /auth3/random:
    $ref: '#/components/paths/randomAuth3'
  /auth3/post:
    $ref: '#/components/paths/postAuth3'
  /auth3/echo/get/json:
    $ref: '#/components/paths/echoGetJsonAuth3'
  /auth3/delay/{seconds}:
    $ref: '#/components/paths/delayAuth3'
  /auth3/status/{code}:
    $ref: '#/components/paths/statusAuth3'

components:
  securitySchemes:
    ApiKeyAuth1:
      type: http
      scheme: bearer
      description: Static key "SuperKey1"
    ApiKeyAuth2:
      type: http
      scheme: bearer
      description: Static key "SuperKey2"
    ApiKeyAuth3:
      type: http
      scheme: bearer
      description: Static key "SuperKey3"

  # Path templates for reuse with different auth mechanisms
  paths:
    # --- Auth 1 ---
    anythingAuth1:
      get:
        summary: Anything endpoint (Auth 1)
        security:
          - ApiKeyAuth1: []
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    sameresponseAuth1:
      post:
        summary: Echo request body (Auth 1)
        security:
          - ApiKeyAuth1: []
        requestBody:
          required: true
          content:
            '*/*':
              schema:
                type: string
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    randomAuth1:
      get:
        summary: Random outcome (Auth 1)
        security:
          - ApiKeyAuth1: []
        responses:
          '200':
            description: Success
          '502':
            description: Bad Gateway
          '401':
            description: Unauthorized
    postAuth1:
      post:
        summary: Post echo endpoint (Auth 1)
        security:
          - ApiKeyAuth1: []
        requestBody:
          content:
            application/json:
              schema:
                type: object
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    echoGetJsonAuth1:
      get:
        summary: Standard GET echo (Auth 1)
        security:
          - ApiKeyAuth1: []
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    delayAuth1:
      get:
        summary: Delay endpoint (Auth 1)
        security:
          - ApiKeyAuth1: []
        parameters:
          - name: seconds
            in: path
            required: true
            schema:
              type: number
              example: 1.5
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    statusAuth1:
      get:
        summary: Status endpoint (Auth 1)
        security:
          - ApiKeyAuth1: []
        parameters:
          - name: code
            in: path
            required: true
            schema:
              type: integer
              example: 400
        responses:
          'default':
            description: Custom status
          '401':
            description: Unauthorized

    # --- Auth 2 ---
    anythingAuth2:
      get:
        summary: Anything endpoint (Auth 2)
        security:
          - ApiKeyAuth2: []
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    sameresponseAuth2:
      post:
        summary: Echo request body (Auth 2)
        security:
          - ApiKeyAuth2: []
        requestBody:
          required: true
          content:
            '*/*':
              schema:
                type: string
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    randomAuth2:
      get:
        summary: Random outcome (Auth 2)
        security:
          - ApiKeyAuth2: []
        responses:
          '200':
            description: Success
          '502':
            description: Bad Gateway
          '401':
            description: Unauthorized
    postAuth2:
      post:
        summary: Post echo endpoint (Auth 2)
        security:
          - ApiKeyAuth2: []
        requestBody:
          content:
            application/json:
              schema:
                type: object
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    echoGetJsonAuth2:
      get:
        summary: Standard GET echo (Auth 2)
        security:
          - ApiKeyAuth2: []
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    delayAuth2:
      get:
        summary: Delay endpoint (Auth 2)
        security:
          - ApiKeyAuth2: []
        parameters:
          - name: seconds
            in: path
            required: true
            schema:
              type: number
              example: 1.5
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    statusAuth2:
      get:
        summary: Status endpoint (Auth 2)
        security:
          - ApiKeyAuth2: []
        parameters:
          - name: code
            in: path
            required: true
            schema:
              type: integer
              example: 400
        responses:
          'default':
            description: Custom status
          '401':
            description: Unauthorized

    # --- Auth 3 ---
    anythingAuth3:
      get:
        summary: Anything endpoint (Auth 3)
        security:
          - ApiKeyAuth3: []
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    sameresponseAuth3:
      post:
        summary: Echo request body (Auth 3)
        security:
          - ApiKeyAuth3: []
        requestBody:
          required: true
          content:
            '*/*':
              schema:
                type: string
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    randomAuth3:
      get:
        summary: Random outcome (Auth 3)
        security:
          - ApiKeyAuth3: []
        responses:
          '200':
            description: Success
          '502':
            description: Bad Gateway
          '401':
            description: Unauthorized
    postAuth3:
      post:
        summary: Post echo endpoint (Auth 3)
        security:
          - ApiKeyAuth3: []
        requestBody:
          content:
            application/json:
              schema:
                type: object
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    echoGetJsonAuth3:
      get:
        summary: Standard GET echo (Auth 3)
        security:
          - ApiKeyAuth3: []
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    delayAuth3:
      get:
        summary: Delay endpoint (Auth 3)
        security:
          - ApiKeyAuth3: []
        parameters:
          - name: seconds
            in: path
            required: true
            schema:
              type: number
              example: 1.5
        responses:
          '200':
            description: Success
          '401':
            description: Unauthorized
    statusAuth3:
      get:
        summary: Status endpoint (Auth 3)
        security:
          - ApiKeyAuth3: []
        parameters:
          - name: code
            in: path
            required: true
            schema:
              type: integer
              example: 400
        responses:
          'default':
            description: Custom status
          '401':
            description: Unauthorized
