jsonschema-for-toml

Crates.iojsonschema-for-toml
lib.rsjsonschema-for-toml
version0.1.0
created_at2025-04-14 13:57:03.502098+00
updated_at2025-04-14 13:57:03.502098+00
descriptionA command-line tool for validating TOML files against JSON Schema.
homepage
repositoryhttps://github.com/foolishell/jsonschema-for-toml
max_upload_size
id1632856
size59,710
Kai Fukushima (foolishell)

documentation

README

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

Commit count: 8

cargo fmt