|
| 1 | +# GTS Documentation Validator (DE0903) |
| 2 | + |
| 3 | +A Rust CLI tool that validates GTS (Global Type System) identifiers in documentation files (`.md`, `.json`, `.yaml`, `.yml`). |
| 4 | + |
| 5 | +This complements the Dylint-based DE0901 lint that validates GTS identifiers in Rust source code. |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +```bash |
| 10 | +# Basic validation |
| 11 | +gts-docs-validator docs modules libs examples |
| 12 | + |
| 13 | +# With vendor validation (ensures all IDs use expected vendor) |
| 14 | +gts-docs-validator --vendor x docs modules libs examples |
| 15 | + |
| 16 | +# With exclusions |
| 17 | +gts-docs-validator --exclude "target/*" --exclude "docs/api/*" . |
| 18 | + |
| 19 | +# JSON output (for CI integration) |
| 20 | +gts-docs-validator --json docs |
| 21 | + |
| 22 | +# Verbose output (shows files being scanned) |
| 23 | +gts-docs-validator --verbose docs |
| 24 | +``` |
| 25 | + |
| 26 | +## Makefile Targets |
| 27 | + |
| 28 | +```bash |
| 29 | +make gts-docs # Validate GTS IDs (structural only) |
| 30 | +make gts-docs-vendor # Validate with --vendor x check |
| 31 | +make gts-docs-test # Run unit tests |
| 32 | +``` |
| 33 | + |
| 34 | +## Options |
| 35 | + |
| 36 | +| Option | Description | |
| 37 | +|--------|-------------| |
| 38 | +| `--vendor <VENDOR>` | Expected vendor for all GTS IDs (e.g., `--vendor x`) | |
| 39 | +| `--exclude <PATTERN>` | Glob patterns to exclude (can be repeated) | |
| 40 | +| `--json` | Output results as JSON | |
| 41 | +| `--verbose` | Show file scanning progress | |
| 42 | + |
| 43 | +## Example Vendors |
| 44 | + |
| 45 | +When using `--vendor`, the following example/placeholder vendors are always tolerated (commonly used in documentation and tutorials): |
| 46 | + |
| 47 | +- `acme` |
| 48 | +- `globex` |
| 49 | +- `example` |
| 50 | +- `demo` |
| 51 | +- `test` |
| 52 | +- `sample` |
| 53 | +- `tutorial` |
| 54 | + |
| 55 | +## Smart Context Detection |
| 56 | + |
| 57 | +The validator automatically handles: |
| 58 | + |
| 59 | +- **Wildcard patterns**: `gts.x.*` is allowed in filter/pattern contexts (e.g., `$filter`, `pattern`, `match`) |
| 60 | +- **Bad examples**: GTS IDs near "invalid", "wrong", "❌" markers are skipped |
| 61 | +- **Trailing tildes**: Schema IDs ending with `~` are properly validated |
| 62 | + |
| 63 | +## GTS Identifier Format |
| 64 | + |
| 65 | +```text |
| 66 | +gts.<vendor>.<org>.<package>.<type>.<version>~ |
| 67 | + │ │ │ │ └── Version (v1, v1.2, etc.) |
| 68 | + │ │ │ └── Type name (snake_case) |
| 69 | + │ │ └── Package name |
| 70 | + │ └── Organization |
| 71 | + └── Vendor identifier |
| 72 | +``` |
| 73 | + |
| 74 | +## Exit Codes |
| 75 | + |
| 76 | +- `0` - All GTS identifiers are valid |
| 77 | +- `1` - Invalid GTS identifiers found |
| 78 | + |
| 79 | +## Related |
| 80 | + |
| 81 | +- **DE0901**: Dylint lint for GTS patterns in Rust source (`make dylint`) |
| 82 | +- **DE0902**: Prevents `schema_for!` on GTS structs (`make dylint`) |
0 commit comments