ajv-validator / ajv-validator/ajv-cli

Error migrating from draft2019 to draft2020

未关闭
#125 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
316
派生
77
PR 合并指标
30 天内没有已合并 PR

描述

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)
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。