significantly simplified the validator and work continues on query

This commit is contained in:
2026-03-03 17:58:31 -05:00
parent 3898c43742
commit e7f20e2cb6
58 changed files with 5446 additions and 5693 deletions

View File

@ -49,7 +49,41 @@ fn main() {
let val: serde_json::Value = serde_json::from_reader(file).unwrap();
if let Some(arr) = val.as_array() {
for (i, _item) in arr.iter().enumerate() {
for (i, item) in arr.iter().enumerate() {
// Enforce test suite structure
let group = item.as_object().expect("Test suite must be an object");
// Validate required suite fields
if !group.contains_key("description")
|| !group.contains_key("database")
|| !group.contains_key("tests")
{
panic!(
"File {} index {} is missing required suite fields (description, database, tests)",
file_name, i
);
}
// Validate required test case fields
let tests = group
.get("tests")
.unwrap()
.as_array()
.expect("Tests must be an array");
for (t_idx, test) in tests.iter().enumerate() {
let t_obj = test.as_object().expect("Test case must be an object");
if !t_obj.contains_key("description")
|| !t_obj.contains_key("data")
|| !t_obj.contains_key("valid")
|| !t_obj.contains_key("schema_id")
{
panic!(
"File {} suite {} test {} is missing required case fields (description, data, valid, schema_id)",
file_name, i, t_idx
);
}
}
// Use deterministic names: test_{filename}_{index}
let safe_filename = to_safe_identifier(file_name);
let fn_name = format!("test_{}_{}", safe_filename, i);