Sign inSign up

weibeld/ajv-cli

By weibeld

Updated over 4 years ago

A Docker image containing ajv-cli (JSON schema validator)

Image
0

6.0K

weibeld/ajv-cli repository overview

ajv-cli

An Alpine based Docker image containing ajv-cli.

GitHub last commit

Tags

The image tag corresponds to the installed ajv-cli version:

Image tagajv-cli version
5.0.05.0.0

Extensions

The Docker image includes the following Ajv extensions:

Examples

Assume the following JSON schema in schema.json:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Websites",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string"
      },
      "url": {
        "type": "string",
        "format": "uri"
      }
    },
    "required": [ "name", "url" ]
  }
}

And the following YAML file in data.yaml:

- name: GitHub
  url: https://github.com
- name: Wikipedia
  url: https://en.wikipedia.org/
- name: Kubernetes
  url: https://kubernetes.io/

To validate this YAML file against the schema, use the following command:

ajv \
  --spec draft2020 \
  -c ajv-formats \
  -s schema.json \
  -d data.yaml

Note the following about this command:

  • The --spec option indicates the version of the specification that the schema adheres too, which is necessary because ajv-cli uses an older version of the specification by default.
  • The -c option imports the ajv-formats extension, which is necessary because the schema uses the "format" keyword.
  • The -s and -d options specify the JSON schema file and the data file to validate, respectively.

Tag summary

Content type

Image

Digest

Size

51.7 MB

Last updated

over 4 years ago

docker pull weibeld/ajv-cli:5.0.0