validator now uses hybrid uuid and numeric index pathing

This commit is contained in:
2026-03-26 14:06:24 -04:00
parent 9fe5a34163
commit 8bf3649465
4 changed files with 231 additions and 5 deletions

View File

@ -53,10 +53,18 @@ impl<'a> ValidationContext<'a> {
if let Some(arr) = self.instance.as_array() {
for i in 0..arr.len() {
if !result.evaluated_indices.contains(&i) {
let mut item_path = format!("{}/{}", self.path, i);
if let Some(child_instance) = arr.get(i) {
if let Some(obj) = child_instance.as_object() {
if let Some(id_str) = obj.get("id").and_then(|v| v.as_str()) {
item_path = format!("{}/{}", self.path, id_str);
}
}
}
result.errors.push(ValidationError {
code: "STRICT_ITEM_VIOLATION".to_string(),
message: format!("Unexpected item at index {}", i),
path: format!("{}/{}", self.path, i),
path: item_path,
});
}
}