Dev
Mock OpenAPI Spec Generator
Used by developers, writers, and creators worldwide.
A mock OpenAPI spec generator removes the tedium of hand-writing YAML boilerplate every time you add a REST resource. Type a resource name like "orders" or "invoices", set your API title and version, and the tool outputs a complete OpenAPI 3.0 document — CRUD paths, request/response schemas, component definitions, and JWT bearer security included. The output validates cleanly with swagger-parser and Stoplight Spectral. Import it into Postman, feed it to openapi-generator-cli to scaffold a typed client, or spin up a Prism mock server before your backend exists. API-first teams use it to lock down the contract between frontend and backend on day one.
Loading usage…
Free forever — no account required
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Type your REST resource name (e.g., "orders", "products") into the Resource Name field.
- Set the API Title and Version fields to match your project's branding and semantic version.
- Click Generate to produce the complete OpenAPI 3.0 YAML document.
- Copy the output and paste it into Swagger Editor, save it as a .yaml file, or import it directly into Postman.
Use Cases
- •Spinning up a Prism mock server with npx @stoplight/prism-cli mock api.yaml before writing any backend code
- •Importing a ready-made CRUD collection into Postman with base URL and JWT bearer token variables pre-wired
- •Scaffolding a TypeScript fetch client in one command via openapi-generator-cli using the generated api.yaml
- •Creating a contract fixture for Schemathesis to run property-based fuzz tests against all five REST endpoints
- •Committing a versioned api.yaml to a monorepo so frontend and backend teams share one authoritative contract
Tips
- →Use singular or plural resource names consistently — the generator outputs plural paths, so enter the plural form ("invoices") to avoid mismatched paths like /invoice.
- →After generating, add an 'example' field to each schema property; Swagger UI and Prism use examples to render realistic mock responses.
- →Bump the version field to match semver (e.g., 2.0.0 vs 1.0.0) when making breaking changes — tools like openapi-diff use this to detect incompatibilities.
- →Combine multiple generated specs by merging their paths and components blocks; generate one spec per resource and use a tool like swagger-merger to assemble the full API.
- →If your API is public and needs no auth, delete the global 'security' key and the securitySchemes component to avoid confusing false authorization prompts in Swagger UI.
- →For contract testing with Schemathesis, point it directly at the saved YAML file using: schemathesis run api.yaml --base-url http://localhost:8000 to catch response schema mismatches early.
FAQ
is the generated yaml actually valid openapi 3.0
Yes. The output includes every required field — the openapi version string, an info block, paths, and components/schemas — and passes swagger-parser and Stoplight Spectral validation without edits. Swagger UI and Redoc will render it immediately. If you run npx @stoplight/spectral-cli lint api.yaml, any warnings will flag optional enhancements like missing descriptions, not structural errors.
how do i generate a client sdk from the output
Save the YAML as api.yaml, then run: openapi-generator-cli generate -i api.yaml -g typescript-fetch -o ./client. Swap typescript-fetch for python, go, java, or any of the 50+ supported targets. Because the spec uses consistent operationIds and named component schemas, the generated code produces clean, predictably named models and service methods rather than anonymous types.
what endpoints and security does the spec include
The generator produces five standard REST operations: GET /resource (list), POST /resource (create), GET /resource/{id} (read), PUT /resource/{id} (update), and DELETE /resource/{id} (delete). Each path has request/response schemas and 200/201/404 status codes, with JWT bearer security applied globally so Swagger UI shows an Authorize button and code generators wire in token injection automatically.