yaml-schema

Crates.ioyaml-schema
lib.rsyaml-schema
version
sourcesrc
created_at2024-06-27 22:04:30.502583
updated_at2024-12-01 03:03:43.295384
descriptionA YAML schema validator
homepage
repository
max_upload_size
id1286246
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
cpal maintainers (github:rustaudio:cpal-maintainers)

documentation

README

ys - yaml-schema

CI Tests

yaml-schema is a tool to validate YAML files against a YAML schema.

The YAML Schema specification is based on JSON Schema (https://json-schema.org/), but expressed as YAML.

yaml-schema is both a Rust library and an executable.

Example Usage

Given a schema.yaml file containing:

type: object
properties:
  foo:
    type: string
  bar:
    type: number

And a valid.yaml file containing:

foo: "I'm a string"
bar: 42

Then when you issue the command

ys -f schema.yaml valid.yaml

Then the command should succeed with exit code 0

On the other hand, when given an invalid.yaml file containing:

foo: 42
bar: "I'm a string"

Then the command

ys -f schema.yaml invalid.yaml

Should fail with exit code 1

Features

yaml-schema uses Cucumber to specify and test features:

See the features folder for all examples.

Installation

Currently, yaml-schema requires Git, Rust and Cargo to build and install: https://doc.rust-lang.org/cargo/

To install the ys binary, simply issue the command:

cargo install yaml-schema

That should build and install the executable at $HOME/.cargo/bin/ys (which should be in your PATH)

Usage

Running ys without any options or arguments should display the help:

A tool for validating YAML against a schema

Usage: ys [OPTIONS] [FILE] [COMMAND]

Commands:
  version  Display the ys version
  help     Print this message or the help of the given subcommand(s)

Arguments:
  [FILE]  The YAML file to validate

Options:
  -f, --schema <SCHEMAS>  The schema to validate against
      --fail-fast         Specify this flag to exit (1) as soon as any error is encountered
  -h, --help              Print help
  -V, --version           Print version
Commit count: 0

cargo fmt