api-mock-server
Spin up mock API servers from OpenAPI/Swagger specs with auto-generated test data.
- License 许可
- MIT
- 最近更新
- 2026-08-23
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- description
- Spin up mock API servers from OpenAPI/Swagger specs with auto-generated test data.
02 资源文件 2
- 参考文档_meta.json282 B
- 参考文档README.md734 B
03 SKILL.md 正文
API Mock Server
Instantly create a mock API server from an OpenAPI/Swagger spec.
Instructions
Step 1: Get the Spec
Accept from user:
- File path (JSON/YAML)
- URL to a spec
- Inline endpoint definitions → convert to OpenAPI 3.0
If no spec exists, help define endpoints interactively and generate one.
Step 2: Start the Mock Server
# Primary: Prism (Stoplight)
npx @stoplight/prism-cli mock <spec-file> --port ${PORT:-4010} --dynamic
# Alternative: json-server for simple REST
npx json-server --watch db.json --port ${PORT:-4010}
--dynamicgenerates realistic fake data from schema constraints- Default port: 4010
Step 3: Verify
# Test a sample endpoint
curl -s http://localhost:4010/api/resource | jq .
# List all routes (Prism logs them on startup)
Fallback: Custom Express Server
If prism is unavailable, generate a minimal Express server:
const express = require('express');
const app = express();
app.use(express.json());
// Auto-generate routes from spec...
Edge Cases
- CORS: Add
--corsflag or setAccess-Control-Allow-Origin: *for browser testing - Auth mocking: Return 401 for endpoints with security schemes when no token provided
- Large specs: Prism handles them fine; json-server may need splitting
- Port conflicts: Check with
lsof -i :<port>before starting
Security
- Mock servers are for development only — never expose to public internet
- Don't include real API keys or credentials in mock responses
Requirements
- Node.js 16+ (for npx)
- No API keys needed
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.