A friendly, fast JSON schema validator for JavaScript, supporting JSON Schema Draft 3. Current stable version is 0.8.23. The library is minimal and synchronous or asynchronous. It produces detailed, human-friendly error messages. Unlike many modern validators, it only supports Draft 3 (not Draft 4+ or 2020-12), making it a legacy choice. The API is simple: create a schema and validate objects. It is not actively maintained, as the last release was years ago. It has no dependencies.
npm install json-gateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a schema, validate an object synchronously, and handle errors.
Use a modern validator like Ajv or @cfworker/json-schema.
Clone the input before validating if mutation is undesirable: schema.validate(JSON.parse(JSON.stringify(input))).
Choose one mode consistently. If using callback, pass a function as second argument to avoid exceptions being thrown.
Install @types/json-gate if available (none exist) or create a declaration file.
Deep clone the schema before use if reuse is needed without defaults applied.
Use import { createSchema } from 'json-gate' instead of import createSchema from 'json-gate'.Ensure input values meet schema requirements.
Set 'additionalProperties' to a boolean or a schema object.
Ensure createSchema() is called with a valid schema object and returns a Schema instance.
No dependency data recorded yet.