zaggino/z-schema/migrating-json-schemas
- community
Checking that the SKILL.md file is still in the repository.
Migrates JSON Schemas between draft versions for use with z-schema. Use when the user wants to upgrade schemas from draft-04 to draft-2020-12, convert between draft formats, update deprecated keywords, replace id with $id, convert definitions to $defs, migrate items to prefixItems, replace dependencies with dependentRequired or dependentSchemas, adopt unevaluatedProperties or unevaluatedItems, or adapt schemas to newer JSON Schema features.
Install
npx vskill@latest install zaggino/z-schema/migrating-json-schemasSKILL.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:
``typescript 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.
Quick reference: keyword changes
| Old keyword (draft-04) | New keyword (draft-2020-12) | Introduced in | |
|---|---|---|---|
id | $id | draft-06 | |
definitions | $defs | draft-2019-09 | |
Array-form items (tuple) | prefixItems | draft-2020-12 | |
additionalItems | items (when prefixItems present) | draft-2020-12 | |
exclusiveMinimum: true (boolean) | exclusiveMinimum: <number> | draft-06 | |
exclusiveMaximum: true (boolean) | exclusiveMaximum: <number> | draft-06 | |
dependencies (string arrays) | dependentRequired | draft-2019-09 | |
dependencies (schema values) | dependentSchemas | draft-2019-09 | |
$recursiveRef / $recursiveAnchor | $dynamicRef / $dynamicAnchor | draft-2020-12 |
For the complete keyword mapping with examples, see references/keyword-mapping.md.
Common migration paths
Draft-04 → Draft-2020-12
This is the largest jump. Apply changes in order:
1. Rename `id` to `$id`
2. Convert boolean `exclusiveMinimum`/`exclusiveMaximum` to numeric
Note: the minimum keyword is removed when converting to exclusiveMinimum as a number, since exclusiveMinimum: 0 means "greater than 0".
3. Rename `definitions` to `$defs`
Update all $ref values that point to #/definitions/... → #/$defs/....
4. Split `dependencies`
5. Convert tuple `items` to `prefixItems`
When items was an array (tuple validation), it becomes prefixItems. The old additionalItems becomes items.
6. Add `$schema` declaration
Draft-07 → Draft-2020-12
Smaller jump. Main changes:
definitions→$defs(and update$refpaths)- Array-form
items→prefixItems additionalItems→items(whenprefixItemspresent)dependencies→dependentRequired/dependentSchemas- Consider adopting
unevaluatedProperties/unevaluatedItemsfor stricter validation of combined schemas
Draft-2019-09 → Draft-2020-12
Minimal changes:
- Array-form
items→prefixItems,additionalItems→items $recursiveRef/$recursiveAnchor→$dynamicRef/$dynamicAnchor
Verifying a migrated schema
After migration, validate the schema itself against the target draft's meta-schema:
Then test data validation to confirm behavior is unchanged:
Backward compatibility
If schemas must work across multiple draft versions, use version: 'none' and set $schema in each schema to declare its own draft:
Reference files
- references/keyword-mapping.md — Complete keyword mapping across all drafts with before/after examples
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/migrating-json-schemas/SKILL.md
Popularity
- Repository stars
- 342
- Repository forks
- 91
- Repository npm downloads, 7 days
- 1,493,099
- 7-day trend score
- 62
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/zaggino/z-schema/migrating-json-schemas)