Generates minimal, deterministic data from a JSON Schema. Version 1.1.1 is current. The library fills values that fit the structure of the schema (e.g., empty strings, zeros, empty arrays) rather than random data. It supports JSON Schema draft-04, including $ref, oneOf, anyOf, allOf, and enum. Unlike data generators like json-schema-faker, it prioritizes simplicity and determinism for use cases like form defaults or test fixtures.
npm install json-schema-emptyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to generate empty or minimal data based on a JSON schema with required fields and constraints.
Do not rely on generated strings to satisfy constraints. Handle string validation separately if needed.
If you need a specific array length, set minItems to the desired length. maxItems has no effect.
To include optional properties, list them in required or merge with a required array.
Use for form defaults or structural stubs, not for strict schema validation.
Use import empty from 'json-schema-empty' in ESM environment or transpile with bundler.
Ensure schema argument is a valid object with a 'type' property (or $ref).
No dependency data recorded yet.