scheval
A fast and smart command-line tool for JSON Schema validation, powered by the jsonschema crate. Currently still in development.
🚀 Installation
If you have cargo-binstall, you can install this tool by running:
$ cargo binstall scheval
Otherwise, you can install it from source:
$ cargo install scheval
✨ Features
Including
vscode: Respectjson.schemasfield at.vscode/settings.jsonif presentsuffix: Validate<filename>.jsonwith<filename>.schema.jsonunder working directory
Excluding
TBD
🚀 Quick Start
scheval can be run without any arguments. It will automatically use all available features.
$ scheval
Alternatively, you can specify a list of smart including features to use:
$ scheval --include vscode # Uses only `vscode`
$ scheval --include suffix # Uses only `suffix`
$ scheval --include vscode --include suffix # Uses both `vscode` and `suffix`
$ # Shorthands provided by `clap`
$ scheval -i vscode -i suffix
$ scheval -ivscode -isuffix
📚 Usage
$ scheval --help
A fast and *smart* command-line tool for JSON Schema validation, powered by the `jsonschema` crate.
Usage: scheval [OPTIONS]
Options:
-i, --include <INCLUDE>
What smart including features to use. Available: `vscode`, `suffix`. Default to all
- `vscode`: Respect `json.schemas` field at `.vscode/settings.json` if present
- `suffix`: Validate `<filename>.json` with `<filename>.schema.json` under working directory
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
📝 Notes
This project uses globwalk for pattern matching, which might be buggy. Notably in fileMatch field:
./is not supported (I've included a quick fix by removing the prefix, but have not considered other cases, like././or!./)../is not supported (A warning will be shown, and the pattern will be ignored)
If you have a good alternative which supports VSCode's fileMatch syntax, please let me know.
Possible alternatives:
TODO
- Implement
vscodeauto detection- Better support for
fileMatch- Relative path
- Absolute path (workspace)
- Support for
url- Local schema (path)
- Remote schema (URL)
- Support for
schema(Inline schema)
- Better support for
- Smartly exclude paths
- Add more tests & documentation
- Better error handling
- Output
- Handle output in
main.rs - Use commandline argument
--verbosefor increased verbosity - Colorize output (https://docs.rs/anstyle or https://docs.rs/colored)
- Handle output in
- Improve performance using references
- Possibly adding more features
- Reduce binary size
- Automation using GitHub Actions
- Release (respecting
cargo-binstall) - Publish
- Release (respecting