ajv-cli
ajv-cli copied to clipboard
Use standard meta schema
From ajv's documentation I see there are standard meta schemas that can be used, but how to do that from the CLI?
Using -m /usr/share/nodejs/ajv/lib/refs/json-schema-draft-04.json
doesn't seem to help at all:
meta-schema /usr/share/nodejs/ajv/lib/refs/json-schema-draft-04.json is invalid
error: no schema with key or ref "http://json-schema.org/draft-04/schema#"
@sim642: did you find the answer?
No, I just ended up removing the meta schema reference before validation in a GitHub Actions workflow where I'm using ajv:
- name: Work around meta-schema missing error # https://github.com/ajv-validator/ajv-cli/issues/199
run: |
sed -i 's|"$schema": "http://json-schema.org/draft-04/schema#",||' src/util/options.schema.json
It's very ugly and not scalable to actual local usage of ajv-cli conveniently.
Ajv doesn’t support draft4 in after v6. There is an option “draft” that would include the correct meta schema automatically without referencing it.
There is an option “draft” that would include the correct meta schema automatically without referencing it.
What option? There isn't one here.
I did find https://ajv.js.org/json-schema.html#draft-04, but installing ajv-draft-04 made no difference. I guess that cannot be used with ajv-cli?
I also found ajv migrate -s schema
to be a nicer workaround than sed-ing the schema...