What this does
- Walks the sample JSON recursively and emits a Draft-07 schema
- Picks the right
typefor each leaf: string / integer / number / boolean / null - For arrays, infers the items schema by sampling all elements (uses oneOf if heterogeneous)
- For objects, generates
propertiesand (optionally)requiredfrom observed keys - Detects common string formats (email, uri, date, date-time, uuid, ipv4)
Workflow
- Paste a representative API response or config sample
- Tweak
requiredandadditionalPropertiesbased on your contract - Copy into your repo as a schema file or paste into an OpenAPI
components.schemasblock - Use with
ajv,jsonschema(Python),gojsonschemaor any validator