Search code examples
visual-studio-codejsonschema

VSCode json.schemas - run validator on command line


On my project, I use a custom json.schemas validator like this:

  "json.schemas": [
    {
      "fileMatch": ["src/super_jsons/**"],
      "url": "./.vscode/superJsonConfig.json"
    }
  ]

It works fine on my JSON files, adding autocomplete (IntelliSense) and inline validation of the allowed properties. You can see a VSCode inline warning screenshot as an example.

My question is: How can I run this custom validator through the command line? Is it possible to integrate it with ESLint or something? My end goal is to integrate it on CI/CD to run during Pull Requests and log the warnings (or even mark them as errors).

Thank you


Solution

  • My final solution was to use ajv-cli and integrate it into our CI/CD.