Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 25 additions & 83 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ categories = ["development-tools::build-utils"]
readme = "README.md"

[workspace]
members = ["gts", "gts-cli", "gts-id", "gts-macros", "gts-macros-cli"]
members = ["gts", "gts-cli", "gts-id", "gts-macros", "gts-macros-cli", "gts-validator"]
resolver = "2"

[workspace.lints.rust]
Expand Down Expand Up @@ -145,6 +145,7 @@ gts-cli = { version = "0.8.1", path = "gts-cli" }
gts-id = { version = "0.8.1", path = "gts-id" }
gts-macros = { version = "0.8.1", path = "gts-macros" }
gts-macros-cli = { version = "0.8.1", path = "gts-macros-cli" }
gts-validator = { version = "0.7.8", path = "gts-validator" }

# Core dependencies
serde = { version = "1.0", features = ["derive"] }
Expand Down Expand Up @@ -175,6 +176,10 @@ schemars = { version = "1.2", features = ["uuid1"] }

# File system
walkdir = "2.5"
glob = "0.3"

# CLI and terminal output
colored = "3.0"

# Format parsing
serde-saphyr = "0.0.10"
38 changes: 38 additions & 0 deletions gts-validator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "gts-validator"
version = "0.7.8"
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
description = "GTS identifier validator for documentation and configuration files"
keywords = ["gts", "validator", "documentation", "linting"]
categories.workspace = true
readme = "README.md"
publish = true

[lints]
workspace = true

[dependencies]
# GTS library for ID validation
gts.workspace = true

# File system traversal
walkdir.workspace = true
glob.workspace = true

# Regex for pattern matching
regex.workspace = true

# Serialization
serde.workspace = true
serde_json.workspace = true
serde-saphyr.workspace = true

# Error handling
anyhow.workspace = true

[dev-dependencies]
tempfile = "3.15"
49 changes: 49 additions & 0 deletions gts-validator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# gts-validator

GTS identifier validator for documentation and configuration files (.md, .json, .yaml).

## Overview

`gts-validator` provides a library for validating GTS (Global Type System) identifiers found in documentation and configuration files.

The crate provides a clean separation between:
- **Core validation engine** (input-agnostic): normalize → validate → report
- **Input strategies** (starting with filesystem scanning)

## Usage

```rust
use std::path::PathBuf;
use gts_validator::{validate_fs, FsSourceConfig, ValidationConfig};

let mut fs_config = FsSourceConfig::default();
fs_config.paths = vec![PathBuf::from("docs"), PathBuf::from("modules")];
fs_config.exclude = vec!["target/*".to_owned()];

let mut validation_config = ValidationConfig::default();
validation_config.vendor = Some("x".to_owned());

let report = validate_fs(&fs_config, &validation_config).unwrap();
println!("Files scanned: {}", report.files_scanned);
println!("Errors: {}", report.errors_count);
println!("OK: {}", report.ok);
```

## Output Formatting

The crate includes output formatters for rendering validation reports:

```rust
use gts_validator::output;

// JSON output
let mut stdout = std::io::stdout();
output::write_json(&report, &mut stdout).unwrap();

// Human-readable output (with color support)
output::write_human(&report, &mut stdout, true).unwrap();
```

## License

Apache-2.0
Loading
Loading