A library for dynamically modifying JSON Schema documents by applying add, remove, and replace operations on properties and definitions. Version 1.0.2 is the current stable release, with no frequent release cadence. Unlike manual schema manipulation, it automatically handles cleanup of $ref references when definitions are removed. Ships TypeScript types.
npm install json-schema-patchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates instantiation of JSONSchemaPatch, adding/removing definitions and properties, and applying the patch to modify the schema in place.
Clone the schema before passing it to JSONSchemaPatch if you need to preserve the original.
Always call `applyPatch()` before reading the modified schema.
Ensure the path is valid (e.g., '/properties') and the parent property exists.
Verify that no remaining $ref targets the definition after removal; otherwise it will persist.
Change const JSONSchemaPatch = require('json-schema-patch') to import { JSONSchemaPatch } from 'json-schema-patch'.Run npm install json-schema-patch and ensure import uses the correct package name.
Ensure you have version 1.0.0 or later, and import the class correctly: import { JSONSchemaPatch } from 'json-schema-patch'.Instantiate with new: const patcher = new JSONSchemaPatch(schema);
No dependency data recorded yet.