← Back to Skills Marketplace
charlie-morrison

api-mock-generator

by charlie-morrison · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
107
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install api-mock-generator
Description
Generate mock API servers from OpenAPI 3.x and Swagger 2.0 specs. Use when creating mock/stub APIs for frontend development, testing, demos, or CI. Generates...
README (SKILL.md)

API Mock Generator

Generate mock API servers and static fixtures from OpenAPI/Swagger specs. Contextual fake data (emails, names, UUIDs, etc.) based on property names and schema types.

Quick Start

# Start a live mock server
python3 scripts/generate_mock.py serve api.json

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

# List discovered routes
python3 scripts/generate_mock.py routes api.json

# Generate sample response for a specific endpoint
python3 scripts/generate_mock.py sample api.json /users

Commands

serve — Live Mock Server

python3 scripts/generate_mock.py serve spec.json [options]

Options:

  • --port, -p — port (default: 3000)
  • --host — host (default: 127.0.0.1)
  • --delay, -d — response delay in ms (simulate latency)
  • --error-rate, -e — random error rate 0.0-1.0 (simulate failures)

Features: CORS headers on all responses, path parameter matching, JSON responses with Content-Type headers.

generate — Static Mock Files

python3 scripts/generate_mock.py generate spec.json -o output_dir/

Creates one JSON file per route + manifest.json with route mapping. Useful for test fixtures or frontend stubs.

routes — Discover Endpoints

python3 scripts/generate_mock.py routes spec.json [--format text|json]

sample — Single Endpoint Preview

python3 scripts/generate_mock.py sample spec.json /users --method GET

Supported Specs

  • OpenAPI 3.x (JSON)
  • Swagger 2.0 (JSON)
  • YAML (requires pip install pyyaml)

Fake Data Generation

Property-name-aware generation:

Property pattern Generated data
*email* realistic email
*name* first/last/full name
*phone* formatted phone
*url*, *website* https URL
*city*, *country* real city/country
*id*, *uuid* UUID v4
*price*, *amount* currency-like number
*image*, *avatar* picsum.photos URL
*description*, *bio* lorem paragraph
*status* active/inactive/pending

Schema-aware: respects enum, example, default, format (date, date-time, email, uri, uuid, ipv4), minimum/maximum, minLength/maxLength, $ref, oneOf/anyOf/allOf.

Exit Codes

  • 0 — success
  • 1 — route not found (sample command)
  • 2 — spec parse error or system error
Usage Guidance
This appears to be a straightforward local mock-server generator. Before running: (1) review the script if you plan to run it on a shared or production host; it binds to a host/port and will serve generated responses. (2) If you use YAML specs, installing PyYAML (pip install pyyaml) is required — installing packages pulls code from PyPI, so do that in a controlled environment if concerned. (3) The responses may contain external image URLs (picsum.photos) which cause clients to make outbound requests if fetched; run in an isolated network if you want no outbound traffic. (4) For large specs or public deployment, validate routing and CORS settings to avoid exposing sensitive data. Overall the skill is internally consistent with its stated purpose.
Capability Analysis
Type: OpenClaw Skill Name: api-mock-generator Version: 1.0.0 The skill is a legitimate utility for generating mock API servers and static fixtures from OpenAPI/Swagger specifications. The code in scripts/generate_mock.py uses standard Python libraries, implements safe YAML parsing via yaml.safe_load, and includes proper path sanitization to prevent traversal during file generation. There are no indicators of data exfiltration, malicious execution, or harmful prompt injection.
Capability Assessment
Purpose & Capability
Name/description match the included Python script and SKILL.md. The code implements OpenAPI/Swagger parsing and mock data generation; no unrelated services, cloud APIs, or credentials are requested.
Instruction Scope
Runtime instructions are limited to running the included Python script (serve/generate/routes/sample) against a local spec file. The instructions do not ask the agent to read unrelated system files, environment variables, or transmit data to external endpoints. Note: YAML support requires PyYAML if you provide YAML specs (the script warns and exits if not installed).
Install Mechanism
No install spec is provided (instruction-only). The bundle contains the runnable Python script only; nothing is downloaded or extracted during install.
Credentials
The skill declares no environment variables, credentials, or config paths. The script does not reference external secrets or request unrelated tokens.
Persistence & Privilege
always is false and the skill does not request persistent/privileged presence or modify other skills or system-wide settings. It runs as a normal user-space script (binds to host/port when serving).
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install api-mock-generator
  3. After installation, invoke the skill by name or use /api-mock-generator
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release
Metadata
Slug api-mock-generator
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is api-mock-generator?

Generate mock API servers from OpenAPI 3.x and Swagger 2.0 specs. Use when creating mock/stub APIs for frontend development, testing, demos, or CI. Generates... It is an AI Agent Skill for Claude Code / OpenClaw, with 107 downloads so far.

How do I install api-mock-generator?

Run "/install api-mock-generator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is api-mock-generator free?

Yes, api-mock-generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does api-mock-generator support?

api-mock-generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created api-mock-generator?

It is built and maintained by charlie-morrison (@charlie-morrison); the current version is v1.0.0.

💬 Comments