question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to validate a schema from https://www.schemastore.org/json/

See original GitHub issue

What version of Ajv are you using? Does the issue happen if you use the latest version? Latest, 8.11.0 Ajv options object

  const ajv = new Ajv2019({ allErrors: true, strict: false });
  ajvErrors(ajv);
  const validate = ajv.compile(composeSchema);

JSON Schema

Available at https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json

I have added HTTPS instead of HTTP to the schema

Sample data

{
  version: '3.4',
  services: {
    'beacon-chain': {
      image: 'beacon-chain.lighthouse-prater.dnp.dappnode.eth:0.1.0',
      build: { context: 'beacon-chain', args: { UPSTREAM_VERSION: 'v2.2.0' } },
      volumes: [ 'beacon-data:/root/.lighthouse' ],
      ports: [ '9000/tcp', '9000/udp' ],
      restart: 'unless-stopped',
      environment: {
        BEACON_API_PORT: 3500,
        HTTP_WEB3PROVIDER: 'http://goerli-geth.dappnode:8545',
        CORSDOMAIN: 'http://lighthouse.dappnode',
        CHECKPOINT_SYNC_URL: '',
        EXTRA_OPTS: ''
      }
    },
    valdator: {
      image: 'valdator.lighthouse-prater.dnp.dappnode.eth:0.1.0',
      build: { context: 'valdator', args: { UPSTREAM_VERSION: 'v2.2.0' } },
      restart: 'unless-stopped',
      environment: {
        VALIDATORS_FILE: '/root/.lighthouse/valdators/valdator_definitions.yml',
        PUBLIC_KEYS_FILE: '/public_keys.txt',
        HTTP_WEB3SIGNER: 'http://web3signer.web3signer-prater.dappnode:9000',
        BEACON_NODE_ADDR: 'http://beacon-chain.lighthouse-prater.dappnode:3500',
        GRAFFITI: 'valdating_from_DAppNode',
        SUPERVISOR_CONF: '/etc/supervisor/conf.d/supervisord.conf',
        DEFAULT_VALIDATOR_PUBLIC_KEY: '',
        EXTRA_OPTS: ''
      }
    }
  },
  volumes: { 'beacon-data': {} },
  wrongKey: {}
}

Your code

https://runkit.com/pablomendezroyo/6255f60913beb2000928fafb

  const ajv = new Ajv2019({ allErrors: true, strict: false });
  ajvErrors(ajv);
  const validate = ajv.compile(composeSchema); // FAILS
  const valid = validate(compose);

Validation result, data AFTER validation, error messages

NOT SUPPORTED: keyword "id", use "$id" for schema ID

What results did you expect? Valid schema, wrong validation Are you going to resolve the issue? No, but happy to contribute

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pablomendezroyocommented, Apr 13, 2022

worked with draft7! thanks

0reactions
epoberezkincommented, Apr 13, 2022

Or you can use draft7 instead if you are not using any draft 2019 features - it produces smaller code size for validation functions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Schema Store
JSON Schemas for common JSON file formats. ... can detect all JSON and YAML files and validate them if a matching schema is...
Read more >
Ask Question - Stack Overflow
json file, I got this message: "Problems loading reference 'https://json.schemastore.org/package': Unable to load schema from 'https://json.
Read more >
ajv-validator/ajv - Gitter
Hello, im testing ajv v7 beta 3 and with this schema ... it fails with Error: strict mode: "additionalItems" without "items" is ignored...
Read more >
Implementations - JSON Schema
Code generation; Web UI generation; Data from schemas. Utilities. General processing; Schema to ... SchemaStore.org - validate against common JSON Schemas ...
Read more >
Support json schema draft-06 & draft-07
https ://json-schema.org/draft-06/schema# and ... https://json.schemastore.org/global.json ... Visual Studio is unable to apply validation to the JSON.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found