A CLI tool and Node.js API for computing the difference between two JSON Schema files (draft-07). Version 1.0.0 supports Node.js >=18.18.0 and ships TypeScript definitions. Unlike generic JSON diff tools, this library performs a semantic diff based on set theory, classifying changes as additions (more permissive) or removals (more restrictive), outputting JSON Schema representations of the added/removed value sets. It is designed for schema migration validation and CI workflows where breaking changes must be flagged.
npm install json-schema-diffNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Compares two JSON Schema objects using async diffSchemas, logs removal (breaking) and addition (non-breaking) diff schemas.
Upgrade Node.js to v18.18.0 or later, or use nvm to switch versions.
In CI, either ensure no removals are introduced, or capture exit code and handle intentionally (e.g., by allowing exit code 1 in script).
Use ESM imports and Node >=18.18.0. Refer to the actual package.json or source for correct requirements.
Convert schemas to draft-07 before diffing, or use a library that supports multiple drafts.
Validate that both schemas use only supported keywords. Test thoroughly with your schema patterns.
Use ESM import: import { diffSchemas } from 'json-schema-diff'; Ensure package.json has 'type': 'module' or use .mjs extension.Use import jsonSchemaDiff from 'json-schema-diff'; then jsonSchemaDiff.diffSchemas(...) OR use named import: import { diffSchemas } from 'json-schema-diff';Ensure inputs are parsed JavaScript objects (e.g., JSON.parse() result) and not strings or arrays.
Resolve $ref externally before diffing, or use a different library that supports references.
No dependency data recorded yet.