Chai plugin for validating values against JSON Schema v4. Current stable version 1.5.1, maintained as a legacy plugin using Tiny Validator tv4 for schema validation. Supports draft-04 only, with no support for later drafts. Key differentiator: provides BDD and TDD assertions directly in Chai tests. Release cadence is low; last release was 2019. Consider chai-json-schema-ajv for newer JSON Schema versions.
npm install chai-json-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates BDD and TDD assertions for JSON Schema validation using chai-json-schema.
Switch to chai-json-schema-ajv for later drafts.
Use chai.tv4.addSchema(uri, schema) before asserting.
Monitor for CVEs; consider alternative libraries like ajv + chai-json-schema-ajv.
Ensure tv4 global is available and jsonpointer is required as 'jsonpointer'.
Install chai as dependency: npm install chai. Then require('chai') before use.Use chai.tv4.addSchema('http://example.com/schema', schema) to pre-register referenced schemas.Validate schema itself with tv4.validate(schema, tv4.getSchema('http://json-schema.org/draft-04/schema#')) or use online validator.