3 releases
0.1.2 | Jan 3, 2025 |
---|---|
0.1.1 | Jan 2, 2025 |
0.1.0 | Dec 23, 2024 |
#2207 in Command line utilities
426 downloads per month
26KB
447 lines
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.schemas
field at.vscode/settings.json
if presentsuffix
: Validate<filename>.json
with<filename>.schema.json
under 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
vscode
auto 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
--verbose
for 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
Dependencies
~11–20MB
~293K SLoC