This tool generates valid JSON Schema documents in the draft 2020-12 dialect, complete with randomly chosen property types, formats, and constraints. It is built for testing the tools that consume schemas — validators, form generators, mock-data producers, and documentation renderers — without hand-writing each example.
How it works
The generator builds an object schema and fills its properties map with a configurable
number of fields. Each field is assigned a random type and type-appropriate constraints:
string -> format: email | date-time | uri (sometimes), minLength, maxLength
integer -> minimum, maximum
number -> minimum, maximum
boolean -> (no extra constraints)
array -> items: { type: <random scalar> }
object -> nested properties (when nesting is enabled)
If you enable required fields, a random subset of the property names is copied into a
required array — and because those names are taken from the actual properties, the schema
stays internally consistent. The additionalProperties flag and $schema declaration are
added so the document is a complete, standalone schema.
Tips and notes
Enable nested objects to test how your tooling handles recursive subschemas, and toggle
additionalProperties to check both the open and closed object cases. Use a high property
count to stress-test renderers and form generators. The output is deterministic only within a
single generation — regenerate for a new shape, or copy and save a schema you want to reuse in
a fixed test.
What each toggle is actually testing
The three toggles in the generator are not cosmetic — each one exercises a different code path in any tool that consumes JSON Schemas:
Required fields. When enabled, a random subset of properties is added to the required array. A schema validator must now reject objects that are missing those keys. A form generator must mark those fields as required and block submission. A mock-data producer must include those fields in every generated object. Toggling this on and off reveals whether your tooling correctly distinguishes between optional and required properties.
additionalProperties. Setting additionalProperties: false closes the schema — objects with extra keys should fail validation. This is one of the most commonly misimplemented parts of JSON Schema validation; many validators silently accept extra properties even when the schema prohibits them. Generate a schema with this flag set, then try validating a document with an extra key. If your validator passes it, you have found a real bug.
Nested objects. Nesting generates a property whose type is object with its own properties sub-map. This tests whether your tooling handles recursive or deeply nested schemas without crashing, infinite-looping, or losing track of required fields at the nested level. Form generators in particular often have bugs that appear only when the schema has more than one level of nesting.
JSON Schema draft 2020-12 and OpenAPI 3.1
The generated schemas use JSON Schema draft 2020-12, which is the dialect adopted by OpenAPI 3.1. If you are building or testing OpenAPI tooling, these schemas are directly usable as component schemas in a 3.1 spec. Older OpenAPI 3.0 tooling used a subset of JSON Schema draft 04 with some dialect differences — if your tools target 3.0, check whether they handle the $schema keyword and the type array syntax from 2020-12 correctly, as those were changed between drafts.