OpenAPI Mock Server for Openclaw

Instantly run a local mock HTTP server from any OpenAPI 3.x or Swagger 2.0 specification file or URL without writing backend code.

phy041
v1.0.3
Mar 23, 2026
0
670
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install phy-openapi-mock-server

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install phy-openapi-mock-server using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is OpenAPI Mock Server?

The OpenAPI Mock Server is a robust development utility designed to instantly turn any OpenAPI 3.x or Swagger 2.0 specification into a fully operational local HTTP server. By pointing the tool to your YAML or JSON schema, it starts a local mock server that outputs schema-compliant mock data on the fly. This eliminates backend dependency bottlenecks, allowing software teams to adopt contract-first workflows where backend and frontend construction can happen concurrently.

Using this setup within the Openclaw Skills ecosystem ensures development teams have reliable, offline, and automated mock APIs running locally. Developers get mock endpoints that validate payloads and return customizable responses without having to write mock-routing logic or deploy containerized stubs.

OpenAPI Mock Server Use Cases

  • Frontend developers blocked by incomplete backend endpoints or APIs under design.
  • QA engineers requiring repeatable, offline test APIs for verification routines or performance trials.
  • Architects testing structural schema changes and payload constraints inside active integration branches.
  • Local software environments needing dynamic sandbox endpoints without hitting external rate limits.

How OpenAPI Mock Server Works

  1. Syntax Check: The tool validates your file path or URL, checking if the OpenAPI specification is syntactically sound YAML or JSON.
  2. Prism CLI Orchestration: It checks for the local presence of the Stoplight Prism CLI (running it via npx or global install) or leverages a local Docker fallback.
  3. Schema Extraction: It reads internal paths and definitions, then inventories every request and response schema mapping.
  4. Execution Setup: It launches the server locally on port 4010 (or a specified custom port) in either passthrough mode or validation mode.
  5. Endpoint Diagnostics: It generates instant curl examples with correct paths, request body hints, and path variables filled with mock values.
  6. Response Generation: Clients querying the mock server receive automatic mock payloads generated straight from the spec's declared examples or schemas.

OpenAPI Mock Server Setup

First, ensure you have Node.js 16+ or Docker installed on your host system. To execute the mock server using this skill, run one of the following commands in your CLI:

# Standard mock server execution from a local file
/openapi-mock openapi.yaml

# Run the mock server from a remote URL spec
/openapi-mock https://petstore.swagger.io/v2/swagger.json

# Run the mock server on a custom port
/openapi-mock openapi.yaml --port 4015

# Run with strict validation (returns 422 for non-compliant payloads)
/openapi-mock openapi.yaml --validate

If Node.js is unavailable, use the alternative Docker command in your shell:

docker run --rm -p 4010:4010 \\
  -v \"$(pwd):/tmp/spec\" \\
  stoplight/prism:latest \\
  mock /tmp/spec/openapi.yaml -h 0.0.0.0

OpenAPI Mock Server Data Schema & Taxonomy

This skill organizes and operates mock server workflows using the following system components:

Attribute Description
Input Spec File Local path to .yaml, .yml, or .json file, or a direct HTTP/S URL to a schema file
Port Option Numerical parameter (default 4010) designating the host address for HTTP traffic
Validation Flag --validate argument maps API constraints to incoming HTTP requests, rejecting invalid calls with a 422 error
Dynamic Flag --dynamic argument instructs the server to output random matching schema values rather than static defaults
Endpoint Report Markdown breakdown highlighting paths, methods, summaries, and expected HTTP status codes

OpenAPI Mock Server Advanced Features

  • Response Code Overrides: Force specific HTTP response scenarios (such as 404 Not Found or 500 Internal Server Error) by supplying the Prefer: code=XXX header in client requests.
  • Dynamic Value Toggling: Supply the Prefer: dynamic=true header during isolated curl queries to bypass static example definitions and trigger schema-based value generation.
  • Seamless Authentication Bypass: Development clients can access secured resources without real credential exchanges simply by sending stub headers like Authorization: Bearer fake-token.
  • Custom Target Filters: Target and serve specific namespaces or tag groupings exclusively, reducing startup log noise on massive specifications.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*