How Mock JSON and the curl and fetch snippets are built
Once a spec can be read, it can also produce a request. For the selected endpoint this tool builds Mock JSON for the request body and response schema, and generates a curl command and fetch() code from the same schema.
The order a mock value is chosen
| Order | Schema key | Example |
|---|---|---|
| 1 | example | the author's example is used as it stands |
| 2 | default | the default value is used |
| 3 | enum | the seed picks one entry |
| 4 | type + format | a value matching date-time, email, uuid and similar formats |
| 5 | minimum / maximum / minItems | a value inside the range and an array length |
Objects fill every properties entry. Arrays produce minItems entries when given (at most three) and two otherwise. Even with nullable or null in a type array the value is filled with something non-null; to see null in a preview, put it in example.
Seeds and reproducibility
Values come from a pseudo-random sequence derived from the seed string. The same seed and schema always produce the same JSON, and a different seed produces different values under the same rules. That makes it usable as a test fixture, and the regenerate button only changes the seed.
How the snippets are assembled
- The URL is the first
serversentry plus the path, with{variables}replaced by their defaults. - Path variables use the parameter's
example, thenschema.example,default, the firstenumvalue, and finally a type-appropriate default. - Only
required: truequery parameters are added. Add optional ones by hand after reading the document. - When a security requirement exists, placeholder headers such as
Authorization: Bearer <TOKEN>orX-Example-Key: <API_KEY>are included. - A request body is sent as Mock JSON with
Content-Type: application/json.
Tokens and keys are placeholders, not real values. Running a snippet unchanged will fail authentication, which is expected: this tool never calls an API.
Questions
Why does the mock differ from a real response?
A schema declares ranges and formats, not data. The mock builds a value that fits the format; do not expect it to match production.
How is oneOf handled?
The first entry's schema is used, because the document alone cannot say which branch would be chosen.
Can I choose the seed?
Any number or string works, and entering the same value again reproduces the earlier mock.
In the 3.0 orders preset, pick the order creation endpoint to see the request body mock and its curl side by side.
Open the toolWritten against the OpenAPI Specification 3.1.0 (2021-02), 3.0.3 and JSON Schema 2020-12. Every example spec and host is synthetic.