#json-schema #toml #validation #output #run #reporting

app jsonschema-for-toml

A command-line tool for validating TOML files against JSON Schema

1 unstable release

Uses new Rust 2024

new 0.1.0 Apr 14, 2025

#775 in Command line utilities

Download history 234/week @ 2025-04-11

234 downloads per month

MIT license

17KB
50 lines

jsonschema-for-toml

CI

A command-line tool for validating TOML files against JSON Schema.

This tool is inspired by jsonschema-cli and provides similar functionality, but specifically for TOML files.

Features

  • Validate TOML files against JSON Schema
  • Support for multiple TOML files in a single run
  • Detailed error reporting
  • Clear validation results output

Installation

cargo install jsonschema-for-toml

Usage

jsonschema-for-toml <SCHEMA> -i <INSTANCE> [-i <INSTANCE>...]

Arguments

  • <SCHEMA>: Path to the JSON Schema file
  • -i, --instance: Path to the TOML file(s) to validate (can be specified multiple times)

Examples

Validate a single TOML file:

jsonschema-for-toml schema.json -i config.toml

Validate multiple TOML files:

jsonschema-for-toml schema.json -i config1.toml -i config2.toml

Output

For each TOML file, the tool will output:

  • <filename> - VALID if the file is valid
  • <filename> - INVALID. Errors: followed by a list of errors if invalid

Example output:

config1.toml - VALID
config2.toml - INVALID. Errors:
1. "age" must be an integer
2. "email" must be a valid email address

Exit Codes

  • 0: All TOML files are valid
  • 1: One or more TOML files are invalid, or there was an error

Development

Building

cargo build

Testing

cargo test

Running Tests with Verbose Output

cargo test -- --nocapture

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Dependencies

~10–17MB
~237K SLoC