#yaml #chevdor #json-schema #schema-file #json-file #cli #validate

app yamlcheck

yamlcheck is a cli to validate a yaml file against a json schema

2 releases

0.1.1 Dec 4, 2024
0.1.0 Mar 9, 2023

#214 in Database interfaces

Download history 4/week @ 2024-09-23 3/week @ 2024-09-30 130/week @ 2024-12-02 14/week @ 2024-12-09

144 downloads per month

MIT license

13KB
72 lines

yamlcheck

A CLI based on valico to check a YAML file using a json schema.

Install

Using Cargo

cargo install yamlcheck

Using Podman/Docker

Well.. nothing to install. An alias at most:

alias yamlcheck='podman run --rm -t docker.io/chevdor/yamlcheck'

Usage

samples/01/file.yaml:

name: Bob
age: 30
comment: |
  This is a comment.
  It can be multiple lines.

samples/01/schema.json:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema#",
    "title": "Sample Schema",
    "description": "Sample Schema",
    "type": "object",
    "additionalProperties": true,
    "properties": {
        "name": {
            "type": "string",
            "description": "Name"
        },
        "age": {
            "description": "Some numbers",
            "type": "number"
        },
        "comment": {
            "description": "Optional: Some comment",
            "type": "string"
        }
    },
    "required": [
        "name",
        "age"
    ]
}

Sample run:

SCHEMA=samples/01/schema.json
YAML=samples/01/file.yaml
yamlcheck check -s $SCHEMA --file $YAML

Output:

valid          : true
strictly valid : true

Dependencies

~18–27MB
~445K SLoC