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

Attempting to validate a schema against a meta-schema errors out #78

Open
CodeGat opened this issue Sep 20, 2024 · 0 comments
Open

Attempting to validate a schema against a meta-schema errors out #78

CodeGat opened this issue Sep 20, 2024 · 0 comments

Comments

@CodeGat
Copy link

CodeGat commented Sep 20, 2024

Thanks for creating this action - it's been a huge help in a bunch of my projects.

Instead of validating data against a schema, I've been looking to validate a schema against a meta-schema (usually a JSON Standards schema such as http://json-schema.org/draft-07/schema#), but I can't seem to get it to work.

Attempts

Attempting with:

with:
  file: schema.json
  json_schema: meta-schema.json  # `curl` http://json-schema.org/draft-07/schema# into `meta-schema.json`
  # No json_schema_version

fails with:

Error: schema with key or id "http://json-schema.org/draft-07/schema" already exists
    at Ajv._checkUnique (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/node_modules/ajv/dist/core.js:465:1)
    at Ajv._addSchema (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/node_modules/ajv/dist/core.js:456:1)
    at Ajv.compile (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/node_modules/ajv/dist/core.js:158:1)
    at schema (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/src/functions/json-validator.js:81:1)
    at jsonValidator (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/src/functions/json-validator.js:115:1)
    at run (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/src/main.js:7:1)
    at /home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/src/main.js:14:1
    at /home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/dist/index.js:68727:3
    at Object.<anonymous> (/home/runner/work/_actions/GrantBirki/json-yaml-validate/d7814b94473939c1daaca2c96131b891d4703a3c/dist/index.js:68730:12)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)

Whereas something like:

with:
  file: schema.json
  json_schema_version: '07-draft'

Doesn't pick up on obvious error with schema.json.

Any help would be appreciated :)

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

No branches or pull requests

1 participant