A JSON Schema validator library supporting Draft 7, 2019-09, and 2020-12 with automatic version detection, default values, property filtering, and external reference resolution. Version 13.0.0 requires Node.js >= 18.17.0 and is pure ESM. Key differentiators include context-aware read/write support, minimal dependencies (jsonref and lodash), full TypeScript definitions, and extensibility via custom validators. Released under MIT license by Vivocha.
npm install jsonpoliceNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic schema validation with required fields and error handling, then demonstrates default value assignment.
Upgrade Node.js to >= 18.17.0.
Use import syntax or dynamic import(). For CommonJS projects, use async import().
Always await schema.validate(data) or use .then().
Always await create(schema) or use .then().
Set $schema in schema or pass options.version to create().
Use import { create } from 'jsonpolice' or dynamic import('jsonpolice').Add the missing required property to the data.
Switch to ESM (add "type": "module" in package.json) or use dynamic import.