node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org ยป

yval

yval

Validator, Translator and Formatter for YAML, JSON, and Others

Synopsis

  # Check if a YAML file is well-formed:
  > yval file.yaml
  # Validate a YAML file against a schema:
  > yval file.yaml --schema=myformat.schemat
  # Validate a YAML file against a schema:
  > yval file.yaml --schema=myformat.schemat

Description

The yval tool is a validator, translator and formatter for YAML, JSON, CSV and TSV data.

Installation

The yval command is currently written in NodeJS. To install it, run:

  > npm install -g yval

Usage

The yval command takes a data file as input and:

  • With no options, loads it and reports whether it is well-formed
  • With --schema=... option will lint/validate it against a schema
  • With --to=... option will write data to stdout in the specified format

If input data is valid, yval will return 0 as the exit code; else it will return 1.

Command Options

The yval command has the following options:

  • -s, --schema=<file> To use yval as a linter/validator, specify a schema file. Supports the schemat and json-schema formats. See Below.
  • -t, --to=<format> With this option, yval will format the input data into the specified format and write it to stdout. Valid formats are: yaml, json, csv and tsv. This option can be used along with the --schema option.
  • -f, --from=<format> Explicitly specify the input format. Usually yval can correctly guess the input format. Use this option when it can't. Valid formats are: yaml, json, csv and tsv. This option can be used along with the --schema option.
  • -q, --quiet Suppress all validation output. Use this when you only care about the translation output, and/or the yval exit code.

See Also

  • "Schemat"<...>
  • "JSON Schema"<...>