openapi: 3.0.0
servers:
  - url: 'http://localhost:1080/'
  - url: 'https://localhost:1080/'
info:
  title: MockServer API
  version: 7.0.0
  description: >-
    MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby and a simple REST API (as shown below).


    MockServer Proxy is a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).


    Both MockServer and the MockServer Proxy record all received requests so that it is possible to verify exactly what requests have been sent by the system under test.


    MockServer also supports AI integration via MCP (Model Context Protocol), enabling AI agents and LLM-powered tools to programmatically create expectations, verify requests, and manage mock server state.
  license:
    url: 'https://github.com/mock-server/mockserver-monorepo/blob/master/LICENSE.md'
    name: Apache 2.0
tags:
  - name: expectation
    description: Create or update expectations - updates if the id matches an existing expectations (only supported by MockServer)
  - name: verify
    description: Verify requests (both MockServer & MockServer Proxy)
  - name: control
    description: Manage state or process (both MockServer & MockServer Proxy)
  - name: import
    description: Import expectations from external formats such as HAR or Postman collections (only supported by MockServer)
  - name: crud
    description: Register a generated CRUD data store backed REST resource (only supported by MockServer)
  - name: files
    description: Store, retrieve, list and delete files in the in-memory file store used by response templates and callbacks (only supported by MockServer)
  - name: chaos
    description: Register service-scoped, TCP and gRPC chaos / fault-injection profiles (only supported by MockServer)
  - name: drift
    description: Inspect and clear recorded mock drift (differences between expectations and observed responses)
  - name: scenario
    description: Inspect, set and trigger stateful scenario state (timed auto-transitions and external triggers) (only supported by MockServer)
  - name: oidc
    description: Generate a turnkey OpenID Connect / OAuth2 provider as a set of expectations (only supported by MockServer)
  - name: asyncapi
    description: Mock and verify AsyncAPI message brokers (only supported by MockServer when mockserver-async is on the classpath)
  - name: wasm
    description: Load and list WebAssembly custom rule modules (only supported by MockServer)
  - name: grpc
    description: Manage gRPC proto descriptors, services and health checking (only supported by MockServer)
  - name: troubleshooting
    description: Diagnose why requests did not match expectations (only supported by MockServer)
  - name: pact
    description: Export and verify Pact consumer-driven contracts (only supported by MockServer)

paths:
  /mockserver/expectation:
    put:
      tags:
        - expectation
      summary: create expectation
      responses:
        '201':
          description: expectations created
          content:
            application/json:
              schema:
                description: "list of upserted expectations"
                type: array
                additionalProperties: false
                items:
                  $ref: "#/components/schemas/Expectation"
        '400':
          description: incorrect request format
        '406':
          description: invalid expectation
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Expectations"
        description: expectation(s) to create
        required: true
  /mockserver/openapi:
    put:
      tags:
        - expectation
      summary: create expectations from OpenAPI or Swagger
      responses:
        '201':
          description: expectations created
          content:
            application/json:
              schema:
                description: "list of upserted expectations"
                type: array
                additionalProperties: false
                items:
                  $ref: "#/components/schemas/Expectation"
        '400':
          description: incorrect request format
        '406':
          description: invalid expectation
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OpenAPIExpectations"
        description: expectation(s) to create
        required: true
  /mockserver/clear:
    put:
      tags:
        - control
      summary: clears expectations and recorded requests that match the request matcher
      responses:
        '200':
          description: expectations and recorded requests cleared
        '400':
          description: incorrect request format
      parameters:
        - in: query
          name: type
          schema:
            type: string
            enum: [ "all", "log", "expectations" ]
            default: "all"
          required: false
          description: specifies the type of information to clear, default if not specified is "all", supported values are "all", "log", "expectations"
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/RequestDefinition"
                - $ref: "#/components/schemas/ExpectationId"
        description: request used to match expectations and record requests to clear
  /mockserver/reset:
    put:
      tags:
        - control
      summary: clears all expectations and recorded requests
      responses:
        '200':
          description: expectations and recorded requests cleared
  /mockserver/retrieve:
    put:
      tags:
        - control
      summary: retrieve recorded requests, active expectations, recorded expectations or log messages
      parameters:
        - in: query
          name: format
          schema:
            type: string
            enum: [ "java", "json", "log_entries" ]
          required: false
          description: changes response format, default if not specified is "json", supported values are "java", "json", "log_entries"
        - in: query
          name: type
          schema:
            type: string
            enum: [ "logs", "requests", "request_responses", "recorded_expectations", "active_expectations", "metrics" ]
          required: false
          description: specifies the type of object that is retrieve, default if not specified is "requests", supported values are "logs", "requests", "request_responses", "recorded_expectations", "active_expectations", "metrics"
      responses:
        '200':
          description: recorded requests or active expectations returned
          content:
            application/json:
              schema:
                oneOf:
                  - type: array
                    additionalProperties: false
                    items:
                      $ref: "#/components/schemas/Expectation"
                  - type: array
                    additionalProperties: false
                    items:
                      $ref: "#/components/schemas/HttpRequest"
                  - type: array
                    additionalProperties: false
                    items:
                      $ref: "#/components/schemas/HttpRequestAndHttpResponse"
            application/java:
              schema:
                type: string
                description: Java code for the list of either Expectations or HttpResponses
            text/plain:
              schema:
                type: string
                description: List of recorded log messages
        '400':
          description: incorrect request format
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RequestDefinition"
        description: >-
          request used to match which recorded requests, expectations or log messages to return, an empty body matches all requests, expectations or log messages
  /mockserver/verify:
    put:
      tags:
        - verify
      summary: verify a request has been received a specific number of times
      responses:
        '202':
          description: matching request has been received specified number of times
        '400':
          description: incorrect request format
        '406':
          description: request has not been received specified numbers of times
          content:
            text/plain:
              schema:
                type: string
                description: 'JUnit expected:<...> but was:<...> format'
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Verification"
        description: request matcher and the number of times to match
        required: true
  /mockserver/verifySequence:
    put:
      tags:
        - verify
      summary: verify a sequence of request has been received in the specific order
      responses:
        '202':
          description: request sequence has been received in specified order
        '400':
          description: incorrect request format
        '406':
          description: request sequence has not been received in specified order
          content:
            text/plain:
              schema:
                type: string
                description: 'JUnit expected:<...> but was:<...> format'
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VerificationSequence"
        description: the sequence of requests matchers
        required: true
  /mockserver/status:
    put:
      tags:
        - control
      summary: return listening ports
      responses:
        '200':
          description: MockServer is running and listening on the listed ports
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ports"
  /mockserver/bind:
    put:
      tags:
        - control
      summary: bind additional listening ports
      description: only supported on Netty version
      responses:
        '200':
          description: >-
            listening on additional requested ports, note: the response ony
            contains ports added for the request, to list all ports use /status
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ports"
        '400':
          description: incorrect request format
        '406':
          description: >-
            unable to bind to ports (i.e. already bound or JVM process doesn't
            have permission)
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Ports"
        description: >-
          list of ports to bind to, where 0 indicates dynamically bind to any
          available port
        required: true
  /mockserver/openapi.yaml:
    get:
      tags:
        - control
      summary: retrieve the OpenAPI specification for MockServer
      description: returns the OpenAPI specification describing the MockServer REST API in YAML format
      responses:
        '200':
          description: OpenAPI specification returned
          content:
            application/yaml:
              schema:
                type: string
                description: OpenAPI specification in YAML format
  /mockserver/configuration:
    get:
      tags:
        - control
      summary: retrieve the current configuration
      description: returns the current MockServer configuration as JSON
      responses:
        '200':
          description: current configuration returned
          content:
            application/json:
              schema:
                type: object
                description: JSON object containing all configuration properties and their current values
    put:
      tags:
        - control
      summary: update the current configuration
      description: updates MockServer configuration properties at runtime, only non-null fields in the request body are applied
      responses:
        '200':
          description: configuration updated successfully, returns the full updated configuration
          content:
            application/json:
              schema:
                type: object
                description: JSON object containing all configuration properties and their current values after the update
        '400':
          description: incorrect request format
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: JSON object containing the configuration properties to update
        description: configuration properties to update, only non-null fields are applied
        required: true
  /mockserver/clock:
    put:
      tags:
        - control
      summary: control the server clock for deterministic time-based testing
      description: >-
        Freeze, advance, or reset MockServer's internal clock. The controllable clock affects
        response template date/time helpers (now_iso_8601, now_epoch, now_rfc_1123, dates.*) and
        expectation TimeToLive expiry. Event-log timestamps and JWT issuance are not affected.
      responses:
        '200':
          description: clock action applied successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClockResponse"
        '400':
          description: incorrect request format (missing or invalid action, invalid instant, non-positive duration)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClockRequest"
        description: clock action to perform
        required: true
    get:
      tags:
        - control
      summary: retrieve the current server clock status
      description: >-
        Returns the current instant, epoch milliseconds, and whether the clock is frozen.
      responses:
        '200':
          description: current clock status returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClockStatus"
  /mockserver/import:
    put:
      tags:
        - import
      summary: import expectations from a HAR or Postman collection
      description: >-
        Converts an HTTP Archive (HAR) export or a Postman collection into MockServer expectations and adds them.
        The format is auto-detected from the document structure or can be forced with the format query parameter.
      parameters:
        - in: query
          name: format
          schema:
            type: string
            enum: [ "har", "postman" ]
          required: false
          description: >-
            forces the import format, supported values are "har" and "postman"; when omitted the format is auto-detected from the request body
      responses:
        '201':
          description: expectations created from the imported document
          content:
            application/json:
              schema:
                description: "list of upserted expectations"
                type: array
                additionalProperties: false
                items:
                  $ref: "#/components/schemas/Expectation"
        '400':
          description: missing body, unsupported format, or unable to auto-detect the import format
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: a HAR export or Postman collection JSON document
        description: HAR or Postman collection JSON document to import
        required: true
  /mockserver/crud:
    put:
      tags:
        - crud
      summary: register a generated CRUD data store
      description: >-
        Registers a REST resource backed by an in-memory data store that automatically handles
        list, read, create, update and delete operations under the supplied base path.
      responses:
        '201':
          description: CRUD resource registered
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  basePath:
                    type: string
                  idStrategy:
                    type: string
        '400':
          description: missing basePath or failed to register CRUD resource
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CrudExpectationsDefinition"
        description: CRUD resource definition including the base path and id strategy
        required: true
  /mockserver/files/store:
    put:
      tags:
        - files
      summary: store a file in the file store
      description: stores a file (text or base64-encoded binary) under the supplied name in the in-memory file store
      responses:
        '201':
          description: file stored
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  name:
                    type: string
                  size:
                    type: integer
        '400':
          description: request body missing the required 'name' and 'content' fields, or empty body
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FileStoreRequest"
        description: file name and content to store
        required: true
  /mockserver/files/retrieve:
    put:
      tags:
        - files
      summary: retrieve a file from the file store
      description: returns the raw bytes of a previously stored file
      responses:
        '200':
          description: file content returned
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '400':
          description: request body missing the required 'name' field
        '404':
          description: file not found
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name:
                  type: string
              required:
                - name
        description: name of the file to retrieve
        required: true
  /mockserver/files/list:
    put:
      tags:
        - files
      summary: list files in the file store
      description: returns the names of all files currently held in the in-memory file store
      responses:
        '200':
          description: list of file names returned
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        '400':
          description: failed to list files
  /mockserver/files/delete:
    put:
      tags:
        - files
      summary: delete a file from the file store
      description: removes a previously stored file from the in-memory file store
      responses:
        '200':
          description: file deleted
        '400':
          description: request body missing the required 'name' field
        '404':
          description: file not found
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name:
                  type: string
              required:
                - name
        description: name of the file to delete
        required: true
  /mockserver/serviceChaos:
    put:
      tags:
        - chaos
      summary: register, remove or clear service-scoped HTTP chaos
      description: >-
        Registers an HTTP chaos / fault-injection profile for a downstream host, removes a host's profile,
        or clears all service-scoped chaos. Supply a 'host' with a 'chaos' object to register, 'host' with
        'remove':true (or no 'chaos') to remove a single host, or 'clear':true to clear all.
      responses:
        '200':
          description: chaos registered, removed, patched or cleared
          content:
            application/json:
              schema:
                type: object
        '400':
          description: invalid request body or invalid chaos profile
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ServiceChaosRequest"
        description: service chaos registration, removal or clear instruction
        required: true
    get:
      tags:
        - chaos
      summary: list registered service-scoped HTTP chaos
      description: returns all registered service-scoped chaos profiles keyed by host, plus any remaining time-to-live
      responses:
        '200':
          description: registered service-scoped chaos returned
          content:
            application/json:
              schema:
                type: object
    patch:
      tags:
        - chaos
      summary: update an existing service-scoped HTTP chaos profile (JSON Merge Patch)
      description: >-
        Applies a JSON Merge Patch to an already-registered service-scoped chaos profile for a host,
        updating only the supplied fields and leaving the rest unchanged.
      responses:
        '200':
          description: chaos profile patched
          content:
            application/json:
              schema:
                type: object
        '400':
          description: invalid request body, unknown host, or invalid chaos profile
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ServiceChaosRequest"
        description: JSON Merge Patch with 'host' and the chaos fields to update
        required: true
  /mockserver/tcpChaos:
    put:
      tags:
        - chaos
      summary: register, remove or clear TCP chaos
      description: >-
        Registers a TCP-layer chaos / fault-injection profile for a downstream host, removes a host's profile,
        or clears all TCP chaos. Supply a 'host' with a 'chaos' object to register, 'host' with 'remove':true
        (or no 'chaos') to remove a single host, or 'clear':true to clear all.
      responses:
        '200':
          description: chaos registered, removed, patched or cleared
          content:
            application/json:
              schema:
                type: object
        '400':
          description: invalid request body or invalid chaos profile
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: >-
                TCP chaos registration, removal or clear instruction with 'host', optional 'chaos', 'remove',
                'clear' and 'ttlMillis' fields
        description: TCP chaos registration, removal or clear instruction
        required: true
    get:
      tags:
        - chaos
      summary: list registered TCP chaos
      description: returns all registered TCP chaos profiles keyed by host, plus any remaining time-to-live
      responses:
        '200':
          description: registered TCP chaos returned
          content:
            application/json:
              schema:
                type: object
    patch:
      tags:
        - chaos
      summary: update an existing TCP chaos profile (JSON Merge Patch)
      description: >-
        Applies a JSON Merge Patch to an already-registered TCP chaos profile for a host,
        updating only the supplied fields and leaving the rest unchanged.
      responses:
        '200':
          description: chaos profile patched
          content:
            application/json:
              schema:
                type: object
        '400':
          description: invalid request body, unknown host, or invalid chaos profile
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: JSON Merge Patch with 'host' and the TCP chaos fields to update
        description: JSON Merge Patch with 'host' and the TCP chaos fields to update
        required: true
  /mockserver/grpcChaos:
    put:
      tags:
        - chaos
      summary: register, remove or clear gRPC chaos
      description: >-
        Registers a gRPC chaos / fault-injection profile for a service, removes a service's profile,
        or clears all gRPC chaos. Supply a 'service' with a 'chaos' object to register, 'service' with
        'remove':true (or no 'chaos') to remove a single service, or 'clear':true to clear all.
      responses:
        '200':
          description: chaos registered, removed, patched or cleared
          content:
            application/json:
              schema:
                type: object
        '400':
          description: invalid request body or invalid chaos profile
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: >-
                gRPC chaos registration, removal or clear instruction with 'service', optional 'chaos', 'remove',
                'clear' and 'ttlMillis' fields
        description: gRPC chaos registration, removal or clear instruction
        required: true
    get:
      tags:
        - chaos
      summary: list registered gRPC chaos
      description: returns all registered gRPC chaos profiles keyed by service, plus any remaining time-to-live
      responses:
        '200':
          description: registered gRPC chaos returned
          content:
            application/json:
              schema:
                type: object
    patch:
      tags:
        - chaos
      summary: update an existing gRPC chaos profile (JSON Merge Patch)
      description: >-
        Applies a JSON Merge Patch to an already-registered gRPC chaos profile for a service,
        updating only the supplied fields and leaving the rest unchanged.
      responses:
        '200':
          description: chaos profile patched
          content:
            application/json:
              schema:
                type: object
        '400':
          description: invalid request body, unknown service, or invalid chaos profile
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: JSON Merge Patch with 'service' and the gRPC chaos fields to update
        description: JSON Merge Patch with 'service' and the gRPC chaos fields to update
        required: true
  /mockserver/drift:
    get:
      tags:
        - drift
      summary: retrieve recorded mock drift
      description: >-
        Returns recorded drift records (differences between expectations and observed responses),
        optionally filtered by expectation id and limited in count.
      parameters:
        - in: query
          name: expectationId
          schema:
            type: string
          required: false
          description: only return drift records for the given expectation id
        - in: query
          name: limit
          schema:
            type: integer
            default: 50
            maximum: 500
          required: false
          description: maximum number of recent drift records to return (default 50, capped at 500), ignored when expectationId is supplied
      responses:
        '200':
          description: drift records returned
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  count:
                    type: integer
                  drifts:
                    type: array
                    items:
                      type: object
        '400':
          description: failed to retrieve drift records
  /mockserver/drift/clear:
    put:
      tags:
        - drift
      summary: clear all recorded mock drift
      description: removes all recorded drift records
      responses:
        '200':
          description: drift records cleared
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  status:
                    type: string
  /mockserver/scenario:
    get:
      tags:
        - scenario
      summary: list all scenarios and their current state
      description: >-
        Returns every known stateful scenario and its current state. Scenarios are created
        implicitly by registering expectations with a scenarioName / scenarioState, or explicitly
        via PUT /mockserver/scenario/{name}. All scenario state is reset when MockServer is reset.
      responses:
        '200':
          description: scenarios listed
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  scenarios:
                    type: array
                    items:
                      type: object
                      additionalProperties: false
                      properties:
                        scenarioName:
                          type: string
                        currentState:
                          type: string
        '400':
          description: failed to list scenarios
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScenarioError'
  '/mockserver/scenario/{name}':
    get:
      tags:
        - scenario
      summary: get the current state of one scenario
      description: Returns the current state of the named scenario (null when the scenario has no state yet).
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
          description: the scenario name
      responses:
        '200':
          description: scenario state returned
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  scenarioName:
                    type: string
                  currentState:
                    type: string
                    nullable: true
        '400':
          description: failed to get scenario state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScenarioError'
    put:
      tags:
        - scenario
      summary: set a scenario's state, optionally scheduling a timed auto-transition
      description: >-
        Sets the named scenario to the given state immediately. Optionally schedules a timed
        auto-transition to nextState after transitionAfterMs milliseconds; the transition only
        fires if the scenario is still in the set state when the timer expires, and scheduling a
        new transition cancels any pending one.
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
          description: the scenario name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - state
              properties:
                state:
                  type: string
                  description: the state to set immediately
                transitionAfterMs:
                  type: integer
                  format: int64
                  description: delay in milliseconds before auto-transitioning to nextState (requires nextState)
                nextState:
                  type: string
                  description: the state to auto-transition to after transitionAfterMs (requires transitionAfterMs)
            examples:
              setState:
                summary: set state immediately
                value:
                  state: Deploying
              timedTransition:
                summary: set state with timed auto-transition
                value:
                  state: Deploying
                  transitionAfterMs: 5000
                  nextState: Deployed
      responses:
        '200':
          description: scenario state set
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  scenarioName:
                    type: string
                  currentState:
                    type: string
                  nextState:
                    type: string
                  transitionAfterMs:
                    type: integer
                    format: int64
        '400':
          description: invalid request (e.g. missing scenario name or state field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScenarioError'
  '/mockserver/scenario/{name}/trigger':
    put:
      tags:
        - scenario
      summary: externally trigger a scenario state transition
      description: >-
        Advances the named scenario to newState immediately. Intended for driving a scenario
        forward from a test harness or CI pipeline.
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
          description: the scenario name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - newState
              properties:
                newState:
                  type: string
                  description: the state to transition the scenario to
            example:
              newState: Failed
      responses:
        '200':
          description: scenario state transition triggered
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  scenarioName:
                    type: string
                  currentState:
                    type: string
        '400':
          description: invalid request (e.g. missing scenario name or newState field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScenarioError'
  /mockserver/oidc:
    put:
      tags:
        - oidc
      summary: generate a turnkey OIDC / OAuth2 provider
      description: >-
        Generates a set of expectations that emulate an OpenID Connect / OAuth2 provider (discovery document,
        JWKS, token, authorize, userinfo and related endpoints) and adds them. An empty body uses the default
        provider configuration.
      responses:
        '201':
          description: OIDC provider expectations created
          content:
            application/json:
              schema:
                description: "list of upserted expectations"
                type: array
                additionalProperties: false
                items:
                  $ref: "#/components/schemas/Expectation"
        '400':
          description: invalid OIDC provider configuration
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: OIDC provider configuration (issuer, client, claims, etc.); an empty body uses defaults
        description: OIDC provider configuration
        required: false
  /mockserver/asyncapi:
    put:
      tags:
        - asyncapi
      summary: load an AsyncAPI specification
      description: >-
        Loads an AsyncAPI specification (JSON or YAML), or a { spec, brokerConfig } document, to mock the
        described message broker. Requires the mockserver-async module on the classpath.
      responses:
        '201':
          description: AsyncAPI specification loaded
          content:
            application/json:
              schema:
                type: object
        '400':
          description: empty or invalid AsyncAPI specification
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '501':
          description: AsyncAPI messaging module is not available on the classpath
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: an AsyncAPI specification (JSON/YAML) or a { spec, brokerConfig } document
        description: AsyncAPI specification or spec plus broker configuration
        required: true
    get:
      tags:
        - asyncapi
      summary: retrieve AsyncAPI mock status
      description: returns the status of the currently loaded AsyncAPI mock. Requires the mockserver-async module on the classpath.
      responses:
        '200':
          description: AsyncAPI status returned
          content:
            application/json:
              schema:
                type: object
        '501':
          description: AsyncAPI messaging module is not available on the classpath
  /mockserver/asyncapi/verify:
    put:
      tags:
        - asyncapi
      summary: verify AsyncAPI messages
      description: >-
        Verifies that messages were published/received against the loaded AsyncAPI mock.
        Requires the mockserver-async module on the classpath.
      responses:
        '202':
          description: verification passed
        '400':
          description: empty or invalid verification request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '406':
          description: verification failed
          content:
            text/plain:
              schema:
                type: string
                description: human-readable description of the verification failure
        '501':
          description: AsyncAPI messaging module is not available on the classpath
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: AsyncAPI message verification request
        description: AsyncAPI message verification request
        required: true
  /mockserver/wasm/modules:
    put:
      tags:
        - wasm
      summary: load a WebAssembly custom rule module
      description: stores a compiled WebAssembly module (raw .wasm bytes) under the name supplied in the query parameter
      parameters:
        - in: query
          name: name
          schema:
            type: string
          required: true
          description: name to register the WASM module under
      responses:
        '201':
          description: WASM module loaded
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  status:
                    type: string
                  moduleName:
                    type: string
        '400':
          description: missing 'name' query parameter or empty module body
      requestBody:
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
              description: raw compiled WebAssembly (.wasm) module bytes
        description: raw compiled WebAssembly module bytes
        required: true
    get:
      tags:
        - wasm
      summary: list loaded WebAssembly modules
      description: returns the names of all currently loaded WebAssembly custom rule modules
      responses:
        '200':
          description: list of WASM module names returned
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        '400':
          description: failed to list WASM modules
  /mockserver/grpc/descriptors:
    put:
      tags:
        - grpc
      summary: load a gRPC proto descriptor set
      description: loads a compiled protobuf FileDescriptorSet (raw bytes) so gRPC services can be matched and mocked
      responses:
        '201':
          description: descriptor set loaded
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  status:
                    type: string
        '400':
          description: empty descriptor set body or failed to load descriptor
      requestBody:
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
              description: compiled protobuf FileDescriptorSet bytes
        description: compiled protobuf FileDescriptorSet bytes
        required: true
  /mockserver/grpc/health:
    put:
      tags:
        - grpc
      summary: set a gRPC health serving status
      description: >-
        Sets the gRPC health-checking serving status for a service (an empty service name sets the default),
        or removes a service override with 'remove':true.
      responses:
        '200':
          description: serving status set or removed
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  status:
                    type: string
                  service:
                    type: string
                  servingStatus:
                    type: string
        '400':
          description: missing or invalid 'service' / 'status' fields
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                service:
                  type: string
                  description: gRPC service name; an empty string sets the default status
                status:
                  type: string
                  enum: [ "UNKNOWN", "SERVING", "NOT_SERVING", "SERVICE_UNKNOWN" ]
                remove:
                  type: boolean
                  description: when true, removes the service override
        description: gRPC service name and serving status
        required: true
    get:
      tags:
        - grpc
      summary: retrieve gRPC health serving statuses
      description: returns the configured gRPC health serving status for each service (the default is reported under "_default")
      responses:
        '200':
          description: serving statuses returned
          content:
            application/json:
              schema:
                type: object
        '400':
          description: failed to get gRPC health status
  /mockserver/mode:
    put:
      tags:
        - control
      summary: set the proxy / mock operating mode
      description: >-
        Sets the operating mode that controls how unmatched requests are handled.
        SIMULATE matches expectations and returns a 404 for unmatched requests;
        SPY matches expectations but forwards (and records) unmatched requests to the real downstream;
        CAPTURE forwards and records all traffic (the same proxy-on-no-match behaviour as SPY).
      parameters:
        - in: query
          name: mode
          schema:
            type: string
            enum: [ "SIMULATE", "SPY", "CAPTURE" ]
          required: true
          description: the operating mode to set
      responses:
        '200':
          description: mode set successfully
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  mode:
                    type: string
                    enum: [ "SIMULATE", "SPY", "CAPTURE" ]
                  proxyUnmatchedRequests:
                    type: boolean
        '400':
          description: missing or unknown mode
    get:
      tags:
        - control
      summary: retrieve the current proxy / mock operating mode
      description: returns the current operating mode and whether unmatched requests are proxied
      responses:
        '200':
          description: current mode returned
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  mode:
                    type: string
                    enum: [ "SIMULATE", "SPY", "CAPTURE" ]
                  proxyUnmatchedRequests:
                    type: boolean
  /mockserver/cassettes:
    put:
      tags:
        - control
      summary: register or update a record/replay cassette
      description: >-
        Registers (or updates) a cassette entry in the in-memory cassette registry from a JSON body.
        The 'path' field is required; 'filename', 'expectationCount' and 'origin' are optional.
      responses:
        '201':
          description: cassette registered
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  path:
                    type: string
                  filename:
                    type: string
                  expectationCount:
                    type: integer
                  origin:
                    type: string
                  lastUsed:
                    type: integer
                    format: int64
        '400':
          description: missing request body or missing 'path' field
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - path
              properties:
                path:
                  type: string
                  description: cassette path (required, used as the registry key)
                filename:
                  type: string
                expectationCount:
                  type: integer
                origin:
                  type: string
        description: cassette registration details
        required: true
    get:
      tags:
        - control
      summary: list registered cassettes
      description: returns all registered cassettes held in the in-memory cassette registry
      responses:
        '200':
          description: registered cassettes returned
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  cassettes:
                    type: array
                    items:
                      type: object
    delete:
      tags:
        - control
      summary: remove a registered cassette
      description: >-
        removes a cassette by path, supplied either as the 'path' query parameter or a JSON body with a 'path' field
      parameters:
        - in: query
          name: path
          schema:
            type: string
          required: false
          description: path of the cassette to remove (alternatively supply 'path' in the request body)
      responses:
        '200':
          description: removal processed
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  removed:
                    type: boolean
        '400':
          description: path missing from both query parameter and body
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                path:
                  type: string
        description: path of the cassette to remove (alternative to the query parameter)
        required: false
  /mockserver/diff:
    put:
      tags:
        - verify
      summary: compare two HTTP requests field-by-field
      description: >-
        Diffs an 'expected' against an 'actual' HttpRequest and returns the per-field differences,
        a total diff count and whether the two requests are identical.
      responses:
        '200':
          description: diff computed
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  diffCount:
                    type: integer
                  identical:
                    type: boolean
                  diffs:
                    type: array
                    items:
                      type: object
        '400':
          description: missing body, missing 'expected'/'actual' fields, or non-HttpRequest definitions
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - expected
                - actual
              properties:
                expected:
                  $ref: "#/components/schemas/HttpRequest"
                actual:
                  $ref: "#/components/schemas/HttpRequest"
        description: the two HTTP requests to compare
        required: true
  /mockserver/generateExpectation:
    put:
      tags:
        - expectation
      summary: generate expectation suggestion(s) from an unmatched request
      description: >-
        Generates one or more suggested expectations for an unmatched HttpRequest. When 'preview' is true
        (the default) the suggestions are only returned; when false they are also added. If an LLM backend
        is configured it is used, otherwise a simple template-based stub is generated.
      responses:
        '200':
          description: expectation suggestion(s) returned
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  suggestions:
                    type: array
                    items:
                      $ref: "#/components/schemas/Expectation"
                  confidence:
                    type: number
                  preview:
                    type: boolean
                  explanation:
                    type: string
        '400':
          description: missing body, missing 'request' field, or failed to parse the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - request
              properties:
                request:
                  $ref: "#/components/schemas/HttpRequest"
                preview:
                  type: boolean
                  default: true
                  description: when true (default) only return suggestions; when false also add them
                limit:
                  type: integer
                  default: 1
                  minimum: 1
                  maximum: 5
                  description: maximum number of suggestions to generate (1-5)
        description: the unmatched request to generate expectation(s) for
        required: true
  /mockserver/explainUnmatched:
    put:
      tags:
        - troubleshooting
      summary: explain why recent requests did not match any expectation
      description: >-
        Returns a diagnostic report for recently recorded unmatched requests, including the closest-matching
        expectations and the per-field differences that prevented a match. An optional 'limit' in the body
        bounds how many unmatched requests are analysed (default 10).
      responses:
        '200':
          description: unmatched-request explanation returned
          content:
            application/json:
              schema:
                type: object
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                limit:
                  type: integer
                  default: 10
                  description: maximum number of recent unmatched requests to analyse
        description: optional limit on the number of unmatched requests to analyse
        required: false
  /mockserver/debugMismatch:
    put:
      tags:
        - troubleshooting
      summary: return per-expectation mismatch debug information for a request
      description: >-
        Evaluates the supplied HttpRequest against every active expectation and returns, for each, whether
        it matched and the per-field differences, plus the closest match. Only HttpRequest definitions are
        supported (not OpenAPI definitions).
      responses:
        '200':
          description: mismatch debug information returned
          content:
            application/json:
              schema:
                type: object
        '400':
          description: an OpenAPI definition was supplied instead of an HttpRequest, or the request could not be processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RequestDefinition"
        description: the request to evaluate against all active expectations
        required: true
  /mockserver/pact:
    put:
      tags:
        - pact
      summary: export active expectations as a Pact contract
      description: >-
        Exports the current active expectations as a Pact consumer-driven contract (JSON). The optional
        'consumer' and 'provider' query parameters set the contract's consumer and provider names.
      parameters:
        - in: query
          name: consumer
          schema:
            type: string
          required: false
          description: consumer name to record in the exported Pact contract
        - in: query
          name: provider
          schema:
            type: string
          required: false
          description: provider name to record in the exported Pact contract
      responses:
        '200':
          description: Pact contract exported
          content:
            application/json:
              schema:
                type: object
                description: Pact consumer-driven contract document
        '400':
          description: failed to export the Pact contract
          content:
            text/plain:
              schema:
                type: string
  /mockserver/pact/verify:
    put:
      tags:
        - pact
      summary: verify active expectations against a Pact contract
      description: >-
        Verifies the supplied Pact contract (JSON) against the current expectations and returns the
        verification result. Returns 202 when verification passes and 406 when it fails.
      responses:
        '202':
          description: Pact verification passed
          content:
            application/json:
              schema:
                type: object
                description: Pact verification result
        '406':
          description: Pact verification failed
          content:
            application/json:
              schema:
                type: object
                description: Pact verification result describing the failures
        '400':
          description: empty or invalid Pact contract
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: Pact contract document to verify against
        description: the Pact contract to verify
        required: true
  /mockserver/wsdl:
    put:
      tags:
        - expectation
      summary: create expectations from a WSDL
      description: generates expectations from a WSDL document (the request body is the raw WSDL) and adds them
      responses:
        '201':
          description: expectations created from the WSDL
          content:
            application/json:
              schema:
                description: "list of upserted expectations"
                type: array
                additionalProperties: false
                items:
                  $ref: "#/components/schemas/Expectation"
        '400':
          description: invalid or unparseable WSDL document
          content:
            text/plain:
              schema:
                type: string
      requestBody:
        content:
          application/xml:
            schema:
              type: string
              description: raw WSDL document
        description: WSDL document to generate expectations from
        required: true
  /mockserver/grpc/services:
    put:
      tags:
        - grpc
      summary: list loaded gRPC services
      description: >-
        Returns the gRPC services available from the loaded proto descriptor set, each with its methods
        and their input/output types and streaming flags.
      responses:
        '200':
          description: loaded gRPC services returned
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    name:
                      type: string
                    methods:
                      type: array
                      items:
                        type: object
                        additionalProperties: false
                        properties:
                          name:
                            type: string
                          inputType:
                            type: string
                          outputType:
                            type: string
                          clientStreaming:
                            type: boolean
                          serverStreaming:
                            type: boolean
        '400':
          description: failed to list gRPC services
          content:
            text/plain:
              schema:
                type: string
  /mockserver/grpc/clear:
    put:
      tags:
        - grpc
      summary: reset the gRPC descriptor store
      description: clears all loaded gRPC proto descriptors and the services derived from them
      responses:
        '200':
          description: gRPC descriptor store reset
  /mockserver/stop:
    put:
      tags:
        - control
      summary: stop running process
      description: only supported on Netty version
      responses:
        '200':
          description: MockServer process is stopping
components:
  schemas:
    ScenarioError:
      description: "scenario request error"
      type: object
      additionalProperties: false
      properties:
        error:
          type: string
    Expectations:
      description: "list of expectations"
      oneOf:
        - $ref: "#/components/schemas/Expectation"
        - type: array
          additionalProperties: false
          items:
            $ref: "#/components/schemas/Expectation"
    Expectation:
      description: "expectation"
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
        priority:
          type: integer
        httpRequest:
          $ref: "#/components/schemas/RequestDefinition"
        httpResponse:
          $ref: "#/components/schemas/HttpResponse"
        httpResponseTemplate:
          $ref: "#/components/schemas/HttpTemplate"
        httpResponseClassCallback:
          $ref: "#/components/schemas/HttpClassCallback"
        httpResponseObjectCallback:
          $ref: "#/components/schemas/HttpObjectCallback"
        httpForward:
          $ref: "#/components/schemas/HttpForward"
        httpForwardTemplate:
          $ref: "#/components/schemas/HttpTemplate"
        httpForwardClassCallback:
          $ref: "#/components/schemas/HttpClassCallback"
        httpForwardObjectCallback:
          $ref: "#/components/schemas/HttpObjectCallback"
        httpOverrideForwardedRequest:
          $ref: "#/components/schemas/HttpOverrideForwardedRequest"
        httpError:
          $ref: "#/components/schemas/HttpError"
        times:
          $ref: "#/components/schemas/Times"
        timeToLive:
          $ref: "#/components/schemas/TimeToLive"
      oneOf:
        - required:
            - httpResponse
        - required:
            - httpResponseTemplate
        - required:
            - httpResponseClassCallback
        - required:
            - httpResponseObjectCallback
        - required:
            - httpForward
        - required:
            - httpForwardTemplate
        - required:
            - httpForwardClassCallback
        - required:
            - httpForwardObjectCallback
        - required:
            - httpOverrideForwardedRequest
        - required:
            - httpError
    ExpectationId:
      description: "pointer to existing expectation"
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
      required:
        - id
    OpenAPIExpectations:
      description: "list of open api expectations"
      oneOf:
        - $ref: "#/components/schemas/OpenAPIExpectation"
        - type: array
          additionalProperties: false
          items:
            $ref: "#/components/schemas/OpenAPIExpectation"
    OpenAPIExpectation:
      description: "open api or swagger expectation"
      type: object
      additionalProperties: false
      properties:
        specUrlOrPayload:
          anyOf:
            - type: string
            - type: object
        operationsAndResponses:
          type: object
          additionalProperties:
            type: string
      required:
        - specUrlOrPayload
    RequestDefinition:
      description: "request definition"
      oneOf:
        - $ref: "#/components/schemas/HttpRequest"
        - $ref: "#/components/schemas/OpenAPIDefinition"
    HttpRequest:
      description: "request properties matcher"
      type: object
      additionalProperties: false
      properties:
        secure:
          type: boolean
        keepAlive:
          type: boolean
        method:
          $ref: "#/components/schemas/StringOrJsonSchema"
        path:
          $ref: "#/components/schemas/StringOrJsonSchema"
        pathParameters:
          $ref: "#/components/schemas/KeyToMultiValue"
        queryStringParameters:
          $ref: "#/components/schemas/KeyToMultiValue"
        body:
          $ref: "#/components/schemas/Body"
        headers:
          $ref: "#/components/schemas/KeyToMultiValue"
        cookies:
          $ref: "#/components/schemas/KeyToValue"
        socketAddress:
          $ref: "#/components/schemas/SocketAddress"
        protocol:
          $ref: "#/components/schemas/Protocol"
    OpenAPIDefinition:
      description: "open api or swagger request matcher"
      type: object
      additionalProperties: false
      properties:
        specUrlOrPayload:
          type: string
        operationId:
          type: string
    HttpResponse:
      description: "response to return"
      type: object
      additionalProperties: false
      properties:
        delay:
          $ref: "#/components/schemas/Delay"
        body:
          $ref: "#/components/schemas/BodyWithContentType"
        cookies:
          $ref: "#/components/schemas/KeyToValue"
        connectionOptions:
          $ref: "#/components/schemas/ConnectionOptions"
        headers:
          $ref: "#/components/schemas/KeyToMultiValue"
        statusCode:
          type: integer
        reasonPhrase:
          type: string
    HttpTemplate:
      description: "template to generate response / request"
      type: object
      additionalProperties: false
      properties:
        delay:
          $ref: "#/components/schemas/Delay"
        templateType:
          enum:
            - VELOCITY
            - JAVASCRIPT
            - MUSTACHE
        template:
          type: string
    HttpForward:
      description: "host and port to forward to"
      type: object
      additionalProperties: false
      properties:
        delay:
          $ref: "#/components/schemas/Delay"
        host:
          type: string
        port:
          type: integer
        scheme:
          enum:
            - HTTP
            - HTTPS
    HttpClassCallback:
      description: "class callback"
      type: object
      additionalProperties: false
      properties:
        delay:
          $ref: "#/components/schemas/Delay"
        callbackClass:
          type: string
    HttpObjectCallback:
      description: "object / method callback"
      type: object
      additionalProperties: false
      properties:
        delay:
          $ref: "#/components/schemas/Delay"
        clientId:
          type: string
        responseCallback:
          type: boolean
    HttpOverrideForwardedRequest:
      description: "override forwarded request"
      oneOf:
        - type: object
          additionalProperties: false
          properties:
            delay:
              "$ref": "#/components/schemas/Delay"
            requestOverride:
              "$ref": "#/components/schemas/HttpRequest"
            requestModifier:
              type: object
              additionalProperties: false
              properties:
                path:
                  type: object
                  additionalProperties: false
                  properties:
                    regex:
                      type: string
                    substitution:
                      type: string
                queryStringParameters:
                  type: object
                  additionalProperties: false
                  properties:
                    add:
                      "$ref": "#/components/schemas/KeyToMultiValue"
                    replace:
                      "$ref": "#/components/schemas/KeyToMultiValue"
                    remove:
                      type: array
                      additionalProperties: false
                      items:
                        type: string
                headers:
                  type: object
                  additionalProperties: false
                  properties:
                    add:
                      "$ref": "#/components/schemas/KeyToMultiValue"
                    replace:
                      "$ref": "#/components/schemas/KeyToMultiValue"
                    remove:
                      type: array
                      additionalProperties: false
                      items:
                        type: string
                cookies:
                  type: object
                  additionalProperties: false
                  properties:
                    add:
                      "$ref": "#/components/schemas/KeyToValue"
                    replace:
                      "$ref": "#/components/schemas/KeyToValue"
                    remove:
                      type: array
                      additionalProperties: false
                      items:
                        type: string
            responseOverride:
              "$ref": "#/components/schemas/HttpResponse"
            responseModifier:
              type: object
              additionalProperties: false
              properties:
                headers:
                  type: object
                  additionalProperties: false
                  properties:
                    add:
                      "$ref": "#/components/schemas/KeyToMultiValue"
                    replace:
                      "$ref": "#/components/schemas/KeyToMultiValue"
                    remove:
                      type: array
                      additionalProperties: false
                      items:
                        type: string
                cookies:
                  type: object
                  additionalProperties: false
                  properties:
                    add:
                      "$ref": "#/components/schemas/KeyToValue"
                    replace:
                      "$ref": "#/components/schemas/KeyToValue"
                    remove:
                      type: array
                      additionalProperties: false
                      items:
                        type: string
        - type: object
          additionalProperties: false
          properties:
            delay:
              "$ref": "#/components/schemas/Delay"
            httpRequest:
              "$ref": "#/components/schemas/HttpRequest"
            httpResponse:
              "$ref": "#/components/schemas/HttpResponse"
    HttpError:
      description: "error behaviour"
      type: object
      additionalProperties: false
      properties:
        delay:
          $ref: "#/components/schemas/Delay"
        dropConnection:
          type: boolean
        responseBytes:
          type: string
    Times:
      description: "number of responses"
      type: object
      additionalProperties: false
      properties:
        remainingTimes:
          type: integer
        unlimited:
          type: boolean
    TimeToLive:
      description: "time expectation is valid for"
      type: object
      additionalProperties: false
      properties:
        timeUnit:
          enum:
            - DAYS
            - HOURS
            - MINUTES
            - SECONDS
            - MILLISECONDS
            - MICROSECONDS
            - NANOSECONDS
        timeToLive:
          type: integer
        unlimited:
          type: boolean
    KeyToMultiValue:
      oneOf:
        - type: array
          additionalProperties: false
          items:
            type: object
            additionalProperties: false
            properties:
              name:
                type: string
              values:
                type: array
                additionalProperties: false
                items:
                  type: string
        - type: object
          additionalProperties: true
          properties:
            keyMatchStyle:
              type: string
              enum:
                - MATCHING_KEY
                - SUB_SET
              default: SUB_SET
          # patternProperties:
          #   "^(?!keyMatchStyle)\\S+$":
          #     oneOf:
          #     - type: array
          #       additionalProperties: false
          #       items:
          #         $ref: "#/components/schemas/StringOrJsonSchema"
          #     - type: object
          #       additionalProperties: false
          #       properties:
          #         parameterStyle:
          #           type: string
          #           enum:
          #           - SIMPLE
          #           - SIMPLE_EXPLODED
          #           - LABEL
          #           - LABEL_EXPLODED
          #           - MATRIX
          #           - MATRIX_EXPLODED
          #           - FORM_EXPLODED
          #           - FORM
          #           - SPACE_DELIMITED_EXPLODED
          #           - SPACE_DELIMITED
          #           - PIPE_DELIMITED_EXPLODED
          #           - PIPE_DELIMITED
          #           - DEEP_OBJECT
          #           default: ''
          #         values:
          #           type: array
          #           additionalProperties: false
          #           items:
          #             $ref: "#/components/schemas/StringOrJsonSchema"
    KeyToValue:
      oneOf:
        - type: array
          additionalProperties: false
          items:
            type: object
            properties:
              name:
                type: string
              value:
                type: string
        - type: object
          additionalProperties: true
          # patternProperties:
          #   "^\\S+$":
          #     $ref: "#/components/schemas/StringOrJsonSchema"
    StringOrJsonSchema:
      description: "string value that can be support nottable, optional or a json schema"
      oneOf:
        - type: string
        - type: object
          additionalProperties: false
          properties:
            not:
              type: boolean
            optional:
              type: boolean
            value:
              type: string
            schema:
              $ref: http://json-schema.org/draft-04/schema
            parameterStyle:
              type: string
              enum:
                - SIMPLE
                - SIMPLE_EXPLODED
                - LABEL
                - LABEL_EXPLODED
                - MATRIX
                - MATRIX_EXPLODED
                - FORM_EXPLODED
                - FORM
                - SPACE_DELIMITED_EXPLODED
                - SPACE_DELIMITED
                - PIPE_DELIMITED_EXPLODED
                - PIPE_DELIMITED
                - DEEP_OBJECT
    SocketAddress:
      description: "remote address to send request to, only used for request overrides"
      type: object
      additionalProperties: false
      properties:
        host:
          type: string
        port:
          type: integer
        scheme:
          enum:
            - HTTP
            - HTTPS
    Protocol:
      description: "protocol matcher"
      enum:
        - HTTP_1_1
        - HTTP_2
    Body:
      description: "request body matcher"
      anyOf:
        - type: object
          description: "binary body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - BINARY
            base64Bytes:
              type: string
            contentType:
              type: string
        - type: object
          description: "json body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - JSON
            json:
              type: string
            contentType:
              type: string
            matchType:
              enum:
                - STRICT
                - ONLY_MATCHING_FIELDS
            matchNumbersAsStrings:
              type: boolean
        - type: object
          description: "json matching fields body matcher"
          additionalProperties: true
        - type: object
          description: "json schema body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - JSON_SCHEMA
            jsonSchema:
              $ref: http://json-schema.org/draft-04/schema
        - type: object
          description: "JSON path body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - JSON_PATH
            jsonPath:
              type: string
        - type: object
          description: "parameter body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - PARAMETERS
            parameters:
              $ref: "#/components/schemas/KeyToMultiValue"
        - type: object
          description: "regex body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - REGEX
            regex:
              type: string
        - type: object
          description: "string body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - STRING
            string:
              type: string
            contentType:
              type: string
            subString:
              type: boolean
        - type: string
          description: "substring body matcher"
        - type: object
          description: "xml body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - XML
            xml:
              type: string
            contentType:
              type: string
        - type: object
          description: "xml schema body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - XML_SCHEMA
            xmlSchema:
              type: string
        - type: object
          description: "xpath body matcher"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - XPATH
            xpath:
              type: string
    BodyWithContentType:
      description: "response body"
      anyOf:
        - type: object
          description: "binary response body"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - BINARY
            base64Bytes:
              type: string
            contentType:
              type: string
        - type: object
          description: "json response body"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - JSON
            json:
              type: string
            contentType:
              type: string
        - type: object
          description: "json response body"
          additionalProperties: true
        - type: object
          description: "string response body"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - STRING
            string:
              type: string
            contentType:
              type: string
        - type: string
          description: "string response body"
        - type: object
          description: "xml response body"
          additionalProperties: false
          properties:
            not:
              type: boolean
            type:
              enum:
                - XML
            xml:
              type: string
            contentType:
              type: string
    Delay:
      description: "response delay"
      type: object
      additionalProperties: false
      properties:
        timeUnit:
          enum:
            - DAYS
            - HOURS
            - MINUTES
            - SECONDS
            - MILLISECONDS
            - MICROSECONDS
            - NANOSECONDS
        value:
          type: integer
        distribution:
          type: object
          additionalProperties: false
          description: "distribution for variable delays: UNIFORM requires min and max, LOG_NORMAL requires median and p99, GAUSSIAN requires mean and stdDev"
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - UNIFORM
                - LOG_NORMAL
                - GAUSSIAN
            min:
              type: integer
              minimum: 0
            max:
              type: integer
              minimum: 0
            median:
              type: integer
              minimum: 1
            p99:
              type: integer
              minimum: 1
            mean:
              type: integer
              minimum: 0
            stdDev:
              type: integer
              minimum: 0
    ConnectionOptions:
      description: "connection options"
      type: object
      additionalProperties: false
      properties:
        suppressContentLengthHeader:
          type: boolean
        contentLengthHeaderOverride:
          type: integer
        suppressConnectionHeader:
          type: boolean
        chunkSize:
          type: integer
        keepAliveOverride:
          type: boolean
        closeSocket:
          type: boolean
        closeSocketDelay:
          $ref: "#/components/schemas/Delay"
    Verification:
      description: "verification"
      type: object
      additionalProperties: false
      properties:
        expectationId:
          $ref: "#/components/schemas/ExpectationId"
        httpRequest:
          $ref: "#/components/schemas/RequestDefinition"
        times:
          $ref: "#/components/schemas/VerificationTimes"
        maximumNumberOfRequestToReturnInVerificationFailure:
          type: integer
      oneOf:
        - required:
            - expectationId
        - required:
            - httpRequest
    VerificationTimes:
      description: "number of request to verify"
      type: object
      additionalProperties: false
      properties:
        atLeast:
          type: integer
        atMost:
          type: integer
    VerificationSequence:
      description: "verification sequence"
      type: object
      additionalProperties: false
      properties:
        expectationIds:
          type: array
          additionalProperties: false
          items:
            $ref: "#/components/schemas/ExpectationId"
        httpRequests:
          type: array
          items:
            $ref: "#/components/schemas/RequestDefinition"
        maximumNumberOfRequestToReturnInVerificationFailure:
          type: integer
      oneOf:
        - required:
            - expectationIds
        - required:
            - httpRequests
    ClockRequest:
      description: "clock control request"
      type: object
      additionalProperties: false
      required:
        - action
      properties:
        action:
          type: string
          enum: [ "freeze", "advance", "reset" ]
          description: >-
            freeze: freeze the clock at the given instant (or current time if instant is omitted);
            advance: advance the frozen clock by durationMillis (freezes first if not already frozen);
            reset: reset the clock to real wall-clock time
        instant:
          type: string
          format: date-time
          description: "ISO-8601 instant to freeze at (only used with action 'freeze'; omit to freeze at current time)"
        durationMillis:
          type: integer
          format: int64
          minimum: 1
          description: "number of milliseconds to advance the clock by (required when action is 'advance')"
    ClockResponse:
      description: "clock control response after a freeze, advance, or reset action"
      type: object
      additionalProperties: false
      properties:
        status:
          type: string
          description: "the action that was performed (freeze, advance, or reset)"
        currentInstant:
          type: string
          format: date-time
          description: "the current server clock instant after the action"
        currentEpochMillis:
          type: integer
          format: int64
          description: "the current server clock time as epoch milliseconds after the action"
    ClockStatus:
      description: "clock status response"
      type: object
      additionalProperties: false
      properties:
        currentInstant:
          type: string
          format: date-time
          description: "the current server clock instant"
        currentEpochMillis:
          type: integer
          format: int64
          description: "the current server clock time as epoch milliseconds"
        frozen:
          type: boolean
          description: "true if the clock is currently frozen"
    Ports:
      description: "list of ports"
      type: object
      additionalProperties: false
      properties:
        ports:
          items:
            type: number
          type: array
    HttpRequestAndHttpResponse:
      description: "request and response"
      type: object
      additionalProperties: false
      properties:
        httpRequest:
          $ref: "#/components/schemas/HttpRequest"
        httpResponse:
          $ref: "#/components/schemas/HttpResponse"
        timestamp:
          type: string
    CrudExpectationsDefinition:
      description: "definition of a generated CRUD data store backed REST resource"
      type: object
      additionalProperties: false
      required:
        - basePath
      properties:
        basePath:
          type: string
          description: "base path the CRUD resource is served under (e.g. /api/users)"
        idField:
          type: string
          default: "id"
          description: "name of the field used as the resource identifier"
        idStrategy:
          type: string
          enum: [ "AUTO_INCREMENT", "UUID" ]
          default: "AUTO_INCREMENT"
          description: "strategy used to generate identifiers for newly created resources"
        initialData:
          type: array
          description: "initial records to seed the data store with"
          items:
            type: object
    FileStoreRequest:
      description: "file to store in the in-memory file store"
      type: object
      additionalProperties: false
      required:
        - name
        - content
      properties:
        name:
          type: string
          description: "name to store the file under"
        content:
          type: string
          description: "file content, either plain text or base64-encoded when base64 is true"
        base64:
          type: boolean
          default: false
          description: "when true, content is treated as base64-encoded binary data"
    ServiceChaosRequest:
      description: "service-scoped HTTP chaos registration, removal or clear instruction"
      type: object
      additionalProperties: true
      properties:
        host:
          type: string
          description: "downstream host the chaos profile applies to (mutually exclusive with clear)"
        chaos:
          type: object
          description: "HTTP chaos profile (fault types, probabilities, error status, etc.); omit (or set remove:true) to remove the host's profile"
        remove:
          type: boolean
          description: "when true, removes the named host's chaos profile"
        clear:
          type: boolean
          description: "when true, clears all service-scoped chaos (mutually exclusive with host)"
        ttlMillis:
          type: integer
          format: int64
          minimum: 1
          description: "optional time-to-live in milliseconds after which the registration auto-reverts"
