A Docker image containing ajv-cli (JSON schema validator)
6.0K
An Alpine based Docker image containing ajv-cli.
The image tag corresponds to the installed ajv-cli version:
The Docker image includes the following Ajv extensions:
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:
--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.-c option imports the ajv-formats extension, which is necessary because the schema uses the "format" keyword.-s and -d options specify the JSON schema file and the data file to validate, respectively.Content type
Image
Digest
Size
51.7 MB
Last updated
over 4 years ago
docker pull weibeld/ajv-cli:5.0.0