Skip to content

Commit 92ac8bc

Browse files
committed
feat: instance schema validation
Signed-off-by: devjow <me@devjow.com>
1 parent 8276d66 commit 92ac8bc

8 files changed

Lines changed: 828 additions & 17 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gts-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ tracing-subscriber.workspace = true
3333
chrono.workspace = true
3434
regex.workspace = true
3535
walkdir.workspace = true
36+
jsonschema.workspace = true
3637

3738
[dev-dependencies]
3839
tempfile = "3.8"

gts-cli/src/gen_instances/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub mod attrs;
22
pub mod parser;
3+
pub mod schema_check;
34
pub mod string_lit;
45
pub mod writer;
56

@@ -27,6 +28,7 @@ use writer::{generate_single_instance, instance_output_path};
2728
/// - Duplicate instance IDs are detected (hard error, both locations reported)
2829
/// - Duplicate output paths are detected
2930
/// - Any output path escapes the sandbox boundary
31+
/// - Any instance fails schema validation (when schemas are present on disk)
3032
/// - File I/O fails
3133
pub fn generate_instances_from_rust(
3234
source: &str,
@@ -73,6 +75,7 @@ pub fn generate_instances_from_rust(
7375

7476
check_duplicate_ids(&all_instances)?;
7577
check_duplicate_output_paths(&all_instances, output, &sandbox_root)?;
78+
schema_check::validate_instances_against_schemas(&all_instances, &sandbox_root)?;
7679

7780
let instances_generated = emit_instances(&all_instances, output, &sandbox_root)?;
7881

0 commit comments

Comments
 (0)