OpenAPI Mock Data Generator
Paste a Swagger or OpenAPI spec in YAML or JSON and get realistic sample requests, responses and Mock Service Worker handlers for every endpoint.
How to make mock data from an OpenAPI spec
Paste your spec
Paste an OpenAPI 3 or Swagger 2.0 file in YAML or JSON, or press Try an example.
Choose what to make
Sample requests and responses, Mock Service Worker handlers, or one JSON file of every response. Filter to one endpoint if you like.
Copy or download the result
Copy the result with one click. Many tools also offer a download.
When to use OpenAPI Mock Data Generator
The front end needs realistic API responses before the back end is built, and the OpenAPI contract is already agreed.
Tests or demo screens need sample payloads that match the spec, without inventing JSON by hand for every endpoint.
Tips for a better OpenAPI Mock Data Generator result
Add example values to important fields in the spec: they are used as they are, so status codes, ids and names in screenshots look real.
Set a seed when the data goes into snapshot tests or docs, so the same spec gives the same output on every run.
OpenAPI Mock Data Generator: limits and what to check
Only references inside the same file are followed, so bundle a spec that is split across files before pasting it.
Patterns with groups or alternatives cannot be filled in, so those strings fall back to a plain word that may not match the pattern.
About OpenAPI Mock Data Generator
Make realistic test data straight from your API contract. Each value follows its schema: enums, formats such as email, uuid and date-time, minimum and maximum, lengths and patterns. Field names guide the rest, so a field called city gets a city and price gets a price. Examples in the spec are used first, references and allOf are followed, and a schema that contains itself stops after two levels.
FAQs
Does it read YAML with inline maps like { type: string }?
Yes. The spec is read with a full YAML parser, so inline maps and lists, anchors and multi-line text all work.
How do I get the same data every time?
Type anything in the seed box. The same seed and spec always give the same values, which keeps snapshots and screenshots stable.
What are Mock Service Worker handlers?
Code for the msw library that answers your app's API calls in the browser or in tests with the sample data, so you can build the front end before the API exists.
Can it follow references to other files?
Only references inside the same file (#/components/...). Bundle a split spec first, for example with redocly bundle.