An actively maintained fork of json-schema-migrate for migrating JSON Schema between drafts: draft-04 to draft-07, draft-2019-09, or draft-2020-12. Version 2.1.0 ships TypeScript types, follows conventional commits, and uses Ajv under the hood. It replaces boolean exclusiveMinimum/Maximum with number form, converts single-value enum to const, replaces constant with const, empty schema with true, and schema {"not":{}} with false. draft2019 additionally splits dependencies into dependentRequired and dependentSchemas and handles $anchor. draft2020 converts array items to prefixItems.
npm install json-schema-migrate-xNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates namespace import and migration of a draft-04 schema to draft-07, draft-2019-09, or draft-2020-12.
Use import * as migrate from 'json-schema-migrate-x' instead of the original package name.
Use import * as migrate from 'json-schema-migrate-x'.
Switch to json-schema-migrate-x.
Clone the schema before passing if original should be preserved: const clone = JSON.parse(JSON.stringify(schema)); migrate.draft7(clone);
Review migration output for anchor changes; adjust references accordingly.
Use 'import * as migrate from "json-schema-migrate-x"' and then call migrate.draft7(schema).
Use namespace import: import * as migrate from 'json-schema-migrate-x'; then migrate.draft7().
Ensure the schema adheres to draft-04 or a known draft; check for syntax errors or unsupported keywords.
Install ajv explicitly: npm install ajv