diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-02-05 16:39:19 +0000 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-02-05 16:39:19 +0000 |
| commit | cad0b0a3664211960dfe6e81ff9afe91934a0eba (patch) | |
| tree | 731cecc411d5682f7805477f207ab40eab4654cd /validators/rust/README.md | |
| parent | f9584d5777618f860bc3a8ee880f339954092ac0 (diff) | |
| download | gitinfo-cad0b0a3664211960dfe6e81ff9afe91934a0eba.tar gitinfo-cad0b0a3664211960dfe6e81ff9afe91934a0eba.tar.gz gitinfo-cad0b0a3664211960dfe6e81ff9afe91934a0eba.tar.bz2 gitinfo-cad0b0a3664211960dfe6e81ff9afe91934a0eba.tar.xz gitinfo-cad0b0a3664211960dfe6e81ff9afe91934a0eba.zip | |
add rust validator
Diffstat (limited to 'validators/rust/README.md')
| -rw-r--r-- | validators/rust/README.md | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/validators/rust/README.md b/validators/rust/README.md new file mode 100644 index 0000000..ea072a2 --- /dev/null +++ b/validators/rust/README.md @@ -0,0 +1,60 @@ +# Rust Validator + +A Rust CLI tool for validating `.gitinfo` files. + +## Requirements + +- Rust 1.70+ (with Cargo) + +## Build + +```bash +cd validators/rust +cargo build --release +``` + +The binary will be at `target/release/validate` (or `validate.exe` on Windows). + +## Usage + +```bash +# Validate .gitinfo in current directory +./target/release/validate + +# Validate a specific file +./target/release/validate path/to/.gitinfo +``` + +Or run directly with Cargo: + +```bash +cargo run -- path/to/.gitinfo +``` + +## Features + +- Parses JSONC (strips `//` and `/* */` comments) +- Removes trailing commas (valid in JSONC, invalid in JSON) +- Validates against the gitinfo JSON Schema +- Checks types, formats (URI, email), and patterns +- Enforces `additionalProperties: false` +- Returns exit code 0 on success, 1 on failure +- Color-coded output (green for success, red for errors) + +## Example Output + +``` +✓ .gitinfo is valid +``` + +``` +Validation failed for .gitinfo: + - .root: invalid URI "not-a-url" + - root: unknown property "invalid_field" +``` + +## Dependencies + +- `serde` / `serde_json` - JSON parsing +- `json_comments` - JSONC comment stripping +- `regex` - Pattern matching for validation |
