{"id":14483710,"url":"https://github.com/ajv-validator/json-schema-migrate","last_synced_at":"2025-06-20T10:36:26.613Z","repository":{"id":55679377,"uuid":"86119309","full_name":"ajv-validator/json-schema-migrate","owner":"ajv-validator","description":"Migrate JSON-Schema draft-04 to draft-07, draft-2019-09 or draft-2020-12","archived":false,"fork":false,"pushed_at":"2021-03-28T08:59:29.000Z","size":33,"stargazers_count":26,"open_issues_count":3,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-25T18:30:50.910Z","etag":null,"topics":["json-schema"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajv-validator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"epoberezkin"}},"created_at":"2017-03-24T23:44:33.000Z","updated_at":"2024-12-20T03:59:28.000Z","dependencies_parsed_at":"2022-08-15T06:20:33.699Z","dependency_job_id":null,"html_url":"https://github.com/ajv-validator/json-schema-migrate","commit_stats":null,"previous_names":["epoberezkin/json-schema-migrate"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajv-validator%2Fjson-schema-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajv-validator%2Fjson-schema-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajv-validator%2Fjson-schema-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajv-validator%2Fjson-schema-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajv-validator","download_url":"https://codeload.github.com/ajv-validator/json-schema-migrate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231443791,"owners_count":18377602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-schema"],"created_at":"2024-09-03T00:02:00.932Z","updated_at":"2024-12-27T05:30:28.533Z","avatar_url":"https://github.com/ajv-validator.png","language":"TypeScript","funding_links":["https://github.com/sponsors/epoberezkin"],"categories":["TypeScript"],"sub_categories":[],"readme":"# json-schema-migrate\n\nMigrate JSON-Schema from draft-04 to draft-07, draft-2019-09 or draft-2020-12\n\n[![build](https://github.com/ajv-validator/json-schema-migrate/workflows/build/badge.svg)](https://github.com/ajv-validator/json-schema-migrate/actions?query=workflow%3Abuild)\n[![npm](https://img.shields.io/npm/v/json-schema-migrate)](https://www.npmjs.com/package/json-schema-migrate)\n[![coverage](https://coveralls.io/repos/github/ajv-validator/json-schema-migrate/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/json-schema-migrate?branch=master)\n\n## Install\n\n```\nnpm install json-schema-migrate\n```\n\n## Usage\n\n```javascript\nconst migrate = require(\"json-schema-migrate\")\nconst schema = {\n  id: \"my-schema\",\n  minimum: 1,\n  exclusiveMinimum: true,\n}\nmigrate.draft7(schema)\n// or migrate.draft2019(schema)\n// or migrate.draft2020(schema)\n\nconsole.log(schema)\n// {\n//  $id: 'my-schema',\n//  exclusiveMinimum: 1\n// }\n```\n\nYou can access Ajv instance that is used to migrate schema using `migrate.getAjv` function:\n\n```javascript\nconsole.log(migrate.getAjv().errorsText(errors))\n```\n\n## Changes in schemas after migration\n\n- `id` is replaced with `$id`\n- `$schema` value becomes draft-07, draft-2019-09 or draft-2020-12 meta-schema\n- draft-04 boolean form of `exclusiveMaximum/Minimum` is replaced with the current number form\n- `enum` with a single allowed value is replaced with `const`\n- Non-standard `constant` is replaced with `const`\n- empty schema is replaced with `true`\n- schema `{\"not\":{}}` is replaced with `false`\n- `draft2019` function additionally replaces:\n  - `definitions` with `$defs`\n  - `dependencies` with `dependentRequired` and `dependentSchemas`\n  - `\"id\": \"#foo\"` with `\"$anchor\": \"foo\"`\n  - `\"id\": \"schema#foo\"` with `\"$id\": \"schema\", \"$anchor\": \"foo\"`\n- `draft2020` function additionally replaces array form of `items` with `prefixItems` (and `additionalItems` with `items`)\n\n## License\n\n[MIT](https://github.com/epoberezkin/json-schema-migrate/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajv-validator%2Fjson-schema-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajv-validator%2Fjson-schema-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajv-validator%2Fjson-schema-migrate/lists"}