JSON Schema validator

I got some json files that I need to run tests to ensure the json is valid and the required fields are provided and also have the appropriate value. Are there in-built features in CircleCI that I can use or does it need to be done outside via some shell/python scripts?

Thanks!

Hello @buntu,

Welcome to the forum! CircleCI provides an ephemeral execution environment in which you can pull code and execute tasks in a pipeline. We do not offer any testing tools directly but provide the platform for you to implement any tool or library.

We also have Orbs! Orbs are bits of pre-made config you can inject into your config that sometimes contain tools that may make it easier to test, deploy and more: https://circleci.com/orbs/registry/

It looks like you could likely use our NodeJS docker image and write a small node app to accomplish this: https://www.npmjs.com/package/jsonschema

Thanks Kyle for the pointers, I’ll try to look through the Orbs or go with the custom test suite.

1 Like

I don’t know if you still have the issue, but if you do, you can use Mega-Linter in your pipeline, it will list all JSON/YAML files and validate them with v8r under the hood, using schemastore.org JSON schemas

From CircleCI, you can call is as a docker image, or using mega-linter-runner

npx mega-linter-runner -e 'ENABLE=JSON,YAML'