ajv-validator / ajv-validator/ajv-cli

Error migrating from draft2019 to draft2020

Open
#125 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
316
Forks
77
PR merge metrics
No merged PRs in 30d

Description

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 ()
at Object.execute (node_modules\ajv-cli\dist\commands\migrate.js:29:24)
at Object. (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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.