migrating-json-schemas
Installation
SKILL.md
Migrating JSON Schemas Between Drafts
z-schema supports draft-04, draft-06, draft-07, draft-2019-09, and draft-2020-12. This skill covers migrating schemas between drafts and verifying them with z-schema.
Migration workflow
- Identify the source draft (check
$schemaorid/$idusage). - Set the target version on the validator:
import ZSchema from 'z-schema'; const validator = ZSchema.create({ version: 'draft2020-12' }); - Run
validator.validateSchema(schema)to surface incompatibilities. - Fix each reported error using the keyword mapping below.
- Re-validate until the schema passes.