ajv-validator / ajv-validator/ajv-cli

Error using --spec=draft2020

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

描述

`ajv migrate -s ./applicant-onboarding-schema_v02.json -o ./applicant-onboarding-schema_v02-draft2020.json --indent=4 --spec=draft2020`

```sh
C:\Users\fieljere\AppData\Roaming\npm\node_modules\ajv-cli\node_modules\ajv\dist\core.js:147
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 C:\Users\fieljere\AppData\Roaming\npm\node_modules\←[4majv-cli←[24m\node_modules\←[4majv←[24m\dist\core.js:147:23) at Ajv2020.validateSchema (C:\Users\fieljere\AppData\Roaming\npm\node_modules\←[4majv-cli←[24m\node_modules\←[4majv←[24m\dist\core.js:260:28)
at migrateSchema (C:\Users\fieljere\AppData\Roaming\npm\node_modules\←[4majv-cli←[24m\dist\commands\migrate.js:37:31)
at Array.map ()
at Object.execute (C:\Users\fieljere\AppData\Roaming\npm\node_modules\←[4majv-cli←[24m\dist\commands\migrate.js:29:24)
at Object. (C:\Users\fieljere\AppData\Roaming\npm\node_modules\←[4majv-cli←[24m\dist\index.js:19:24)
←[90m at Module._compile (node:internal/modules/cjs/loader:1103:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
```

I have draft-04 schemas I want to migrate to 2020 and I'm getting the error above.

If I change the command to use `--spec=draft2019`, everything works as expected

i noticed the stack trace indicates the error message referencing draft/2019-09 instead of 2020-12 in the Ajv2020.validate import

贡献指南

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

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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