Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error migrating from draft2019 to draft2020 #125

Open
mikethecalamity opened this issue Apr 6, 2021 · 2 comments
Open

Error migrating from draft2019 to draft2020 #125

mikethecalamity opened this issue Apr 6, 2021 · 2 comments

Comments

@mikethecalamity
Copy link

Using version 5.0.0, there is an error migration from draft2019 to draft2020.

my-schema.json

{
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "$id": "https://schema.com/my-schema.json",
    "type": "object",
    "required": [
        "number"
    ],
    "properties": {
        "number": {
            "type": "number"
        }
    }
}

command

> ajv migrate -s "my-schema.json" --spec=draft2020 --indent=4
npm\node_modules\ajv-cli\node_modules\ajv\dist\core.js:133
                throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
                ^

Error: no schema with key or ref "https://json-schema.org/draft/2019-09/schema"
    at Ajv2020.validate (node_modules\ajv-cli\node_modules\ajv\dist\core.js:133:23)
    at Ajv2020.validateSchema (node_modules\ajv-cli\node_modules\ajv\dist\core.js:244:28)
    at migrateSchema (node_modules\ajv-cli\dist\commands\migrate.js:37:31)
    at Array.map (<anonymous>)
    at Object.execute (node_modules\ajv-cli\dist\commands\migrate.js:29:24)
    at Object.<anonymous> (node_modules\ajv-cli\dist\index.js:19:24)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
@epoberezkin
Copy link
Member

at the moment it only supports migrating from draft-04 to any of drafts 7, 2019, 2020 - probably should be clarified in the docs.

@epoberezkin
Copy link
Member

epoberezkin commented Apr 6, 2021

That’s the issue: ajv-validator/json-schema-migrate#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants