How to generate openapi component schemas from json samples
- Step 1Gather a sample response for each resource type — Collect one complete sample JSON for each resource — User, Order, Product, etc. A complete sample with all fields present produces the most accurate schema.
- Step 2Generate the component schema — Paste the sample and click Generate. The output is a JSON Schema object suitable for direct use as a components/schemas entry.
- Step 3Name and add to your OpenAPI spec — In YAML: under components: schemas:, add a key like UserResponse: followed by the generated schema. In JSON, add it under components.schemas.UserResponse.
- Step 4Reference with $ref in path operations — In your path response definitions, reference the schema: content: application/json: schema: $ref: '#/components/schemas/UserResponse'. The OpenAPI validator will resolve the reference and validate response examples against the schema.
Frequently asked questions
What OpenAPI Schema Object constraints does this tool not infer automatically?+
The generator infers type, properties, required, and items for arrays. It does not infer format (e.g. date-time, email, uuid), minLength/maxLength, minimum/maximum, pattern, or enum from sample values. Add these constraints manually after generation to tighten the schema for documentation and validation purposes.
How do I handle nullable fields in OpenAPI 3.0?+
OpenAPI 3.0 uses nullable: true alongside the type declaration rather than a type array. After generating the schema, for any field that could be null, add nullable: true to the property definition. OpenAPI 3.1 aligns with JSON Schema and uses type: [string, null] instead.
Is the API response data transmitted to JAD Apps?+
No. Schema inference runs entirely in your browser. Data models, API response structures, and field definitions are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.