OpenAPI Stub from JSON
Paste sample request and response JSON and generate a ready-to-edit OpenAPI 3.1 path operation with inferred schemas, parameters, examples, components, and security boilerplate.
What this tool does
Paste sample request and response JSON and this tool generates a complete OpenAPI 3.1 path-and-operation stub. It infers JSON Schema from the samples, wires those schemas into requestBody and responses, adds path and query parameters, and can emit YAML or JSON for pasting into a larger spec.
It is designed for the early documentation step: you have example payloads from a client, a test fixture, a log, or a prototype, and you want a deterministic OpenAPI starting point instead of an empty path block.
It can generate:
- request and response body schemas from JSON objects, arrays, scalars, and nulls;
requiredlists based on observed object keys;- string formats such as email, URI, UUID, date, date-time, and IPv4;
- component schemas plus
$ref, or inline schemas; - path parameters from
/things/{thingId}and typed query parameters from a sample query string; - optional bearer, basic, or
X-API-Keysecurity boilerplate; - optional generic 400 and 500 error responses.
Worked example
Use this request:
{"name":"Ada Lovelace","email":"[email protected]","active":true}
and this response:
{"id":7,"name":"Ada Lovelace","email":"[email protected]","created_at":"2026-08-21T07:00:00Z"}
with Method: POST, Path: /users, and Operation ID: createUser. The YAML output includes a path operation like:
openapi: 3.1.0
paths:
/users:
post:
operationId: createUser
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
The generated component schemas infer email as a formatted string, active as boolean, id as integer, and created_at as date-time. Review the descriptions, validation rules, enum choices, headers, and auth scopes before publishing the spec.
Limits and edge cases
- This generates one operation per run. Use it repeatedly for multiple endpoints, or use a HAR-to-OpenAPI workflow when you have a whole captured session.
- A sample can only show what it contains. It cannot infer enums, minimum/maximum values, regex patterns, length limits, auth scopes, headers, pagination semantics, or business descriptions.
- Empty arrays become arrays with unconstrained item schemas;
nullvalues become OpenAPI 3.1 JSON Schema null types but do not reveal the intended non-null type. - Array-of-object samples are merged across every element. Keys present in every object stay required; keys seen only in some elements become optional.
- The output is a stub. Treat it as a structured first draft, then edit names, summaries, descriptions, examples, response coverage, and validation constraints.
FAQ
Is the output OpenAPI 3.0 or 3.1?
The document uses OpenAPI 3.1.0. That means JSON Schema nulls are represented with the JSON Schema type system instead of the older OpenAPI 3.0 nullable keyword.
Does it send my JSON anywhere?
No. The page runs the Rust WebAssembly generator in your browser, and CLI/chat runs are local to the gizza runtime. There is no network fetch or remote schema service.
How are path parameters generated?
Any braced path segment, such as /users/{userId}, becomes a required in: path parameter with a string schema. The sample JSON does not know the path parameter type, so tighten it by hand if the ID is numeric or UUID-shaped.
When should I turn off component schemas?
Leave components on when you want reusable request/response schemas. Turn them off for tiny examples, documentation snippets, or tests where an inline schema is easier to read.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool openapi-stub-from-json 'request_json={
"name": "Ada Lovelace",
"email": "[email protected]",
"active": true
}'New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/openapi-stub-from-json/?request_json=%7B%0A%20%20%22name%22%3A%20%22Ada%20Lovelace%22%2C%0A%20%20%22email%22%3A%20%22ada%40example.com%22%2C%0A%20%20%22active%22%3A%20true%0A%7D&response_json=%7B%0A%20%20%22id%22%3A%207%2C%0A%20%20%22name%22%3A%20%22Ada%20Lovelace%22%2C%0A%20%20%22email%22%3A%20%22ada%40example.com%22%2C%0A%20%20%22created_at%22%3A%20%222026-08-21T07%3A00%3A00Z%22%0A%7D&method=post&path=%2Fusers%2F%7BuserId%7D&query=include%3Dprofile%26active%3Dtrue%26limit%3D25&status=200&content_type=application%2Fjson&operation_id=createUser&tag=Users&title=Sample%20API&api_version=1.0.0&server_url=https%3A%2F%2Fapi.example.com%2Fv1&security=none&format=yaml&components=true&extract_nested=true&required_props=true&detect_formats=true&include_examples=true&include_error_responses=trueMachine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
