API Mock Generator for Openclaw

A high-performance utility to generate live mock API servers or static JSON fixtures directly from OpenAPI and Swagger specifications.

charlie-morrison
v1.0.1
May 1, 2026
0
942
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install api-mock-generator

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 api-mock-generator 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 API Mock Generator?

The API Mock Generator is a lightweight, pure Python tool designed to streamline the development lifecycle by decoupling frontend and backend teams. By leveraging existing OpenAPI 3.x or Swagger 2.0 specifications, this tool creates a functional mock environment that simulates real-world API behavior. As a standout entry in the Openclaw Skills library, it offers developers the ability to prototype rapidly without waiting for backend implementation.

The tool is particularly adept at generating contextual fake data. Instead of generic strings, it recognizes property names like email, phone, or uuid to provide realistic responses. Whether you need a live server for local development or static files for CI/CD pipelines, this skill provides a robust solution for API simulation without the need for external dependencies.

API Mock Generator Use Cases

  • Accelerating frontend development by simulating backend APIs before they are built.
  • Generating static JSON fixtures for automated testing and CI/CD pipelines.
  • Showcasing UI/UX demos with realistic, context-aware data instead of placeholder text.
  • Testing application resilience by simulating network latency and random server errors.
  • Mapping and discovering available routes within complex OpenAPI or Swagger specifications.

How API Mock Generator Works

  1. The user provides an OpenAPI (JSON/YAML) or Swagger specification file as the primary source.
  2. The generator parses the schema, resolving all references and identifying defined endpoints and data models.
  3. Based on the selected command, the tool either initializes a local HTTP server or prepares a directory for static file generation.
  4. Data generation logic is applied, using property-name patterns and schema constraints to create realistic payloads.
  5. For live servers, the tool handles incoming HTTP requests, matches paths, and serves JSON responses with appropriate CORS headers.

API Mock Generator Setup

To get started with this tool from the Openclaw Skills repository, ensure you have Python 3 installed and follow these steps:

# Start a live mock server on the default port
python3 scripts/generate_mock.py serve api.json

# Generate static JSON mock files for your frontend stubs
python3 scripts/generate_mock.py generate api.json -o mocks/

# Optional: Install YAML support if your spec is in YAML format
pip install pyyaml

API Mock Generator Data Schema & Taxonomy

The tool uses a sophisticated pattern-matching system to ensure data realism. Below is how the skill organizes and generates metadata:

Property Pattern Generated Data Type
*email* Realistic, formatted email address
*name* Context-aware first, last, or full name
*id*, *uuid* RFC-compliant UUID v4
*price*, *amount* Currency-compatible numerical values
*image*, *avatar* Valid placeholder URLs via picsum.photos

When generating static files, the tool creates a structured directory where each route is represented by a JSON file, accompanied by a manifest.json for easy routing reference.

API Mock Generator Advanced Features

  • Random error simulation using the --error-rate flag to test client-side failure handling.
  • Configurable response delays via --delay to mimic real-world network conditions and latency.
  • Full CORS header support on all responses for seamless integration with modern web browsers.
  • Deep schema awareness that respects enums, date-time formats, and complex logic like oneOf or anyOf.
  • Integration-ready CLI output that allows other Openclaw Skills to consume route data in JSON format.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*