Skip to content
HALOWERK

Codewerk

mock from openapi

No hosted mock endpoint is started; the service returns what a static mock server would answer. Response choice follows the common mock-server convention (Prism): the requested status (prefer_status) or the lowest declared 2xx; media type by Accept header, JSON preferred. Body source in order: media-type example, first named example, schema example(s), otherwise generated with json-schema-faker 0.6.3 from the schema with a fixed seed, so the same document and seed always give the same body.

POST https://code.halowerk.com/v1/mock-from-openapi

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
specSee schemaYesThe OpenAPI document as a JSON object or JSON/YAML string (max. 2 MB). External $ref values are rejected.
requestsarrayNoOptional concrete requests to answer; without requests every operation gets its default mock response.
seedintegerNoSeed for generated bodies.
max_operationsintegerNo
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "spec"
  ],
  "properties": {
    "spec": {
      "description": "The OpenAPI document as a JSON object or JSON/YAML string (max. 2 MB). External $ref values are rejected.",
      "anyOf": [
        {
          "type": "object"
        },
        {
          "type": "string",
          "minLength": 2,
          "maxLength": 2000000
        }
      ]
    },
    "requests": {
      "type": "array",
      "maxItems": 50,
      "description": "Optional concrete requests to answer; without requests every operation gets its default mock response.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "method",
          "path"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "PUT",
              "POST",
              "DELETE",
              "OPTIONS",
              "HEAD",
              "PATCH",
              "TRACE"
            ]
          },
          "path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 2000,
            "description": "Request path including optional query string, e.g. /pets/42?verbose=true"
          },
          "headers": {
            "type": "object",
            "maxProperties": 50,
            "additionalProperties": {
              "type": "string",
              "maxLength": 2000
            }
          },
          "body": {
            "description": "JSON request body."
          },
          "prefer_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "Ask for a specific declared response status (like Prism's Prefer: code=...)."
          }
        }
      }
    },
    "seed": {
      "type": "integer",
      "minimum": 1,
      "maximum": 2147483647,
      "default": 1,
      "description": "Seed for generated bodies."
    },
    "max_operations": {
      "type": "integer",
      "minimum": 1,
      "maximum": 200,
      "default": 100
    }
  }
}

Open original schema

Published input example

{
  "spec": {
    "openapi": "3.0.3",
    "info": {
      "title": "Pets",
      "version": "1"
    },
    "paths": {
      "/pets/{id}": {
        "get": {
          "operationId": "getPet",
          "parameters": [
            {
              "name": "id",
              "in": "path",
              "required": true,
              "schema": {
                "type": "integer"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "ok",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "required": [
                      "id",
                      "name"
                    ],
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "requests": [
    {
      "method": "GET",
      "path": "/pets/42"
    }
  ]
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’