validation progress

This commit is contained in:
2026-04-03 19:24:21 -04:00
parent 4411ac82f7
commit e4286ac6a9
5 changed files with 243 additions and 6 deletions

View File

@ -17,6 +17,7 @@ impl<'a> ValidationContext<'a> {
if let Some(ref one_of) = self.schema.one_of {
let mut passed_candidates: Vec<(Option<String>, usize, ValidationResult)> = Vec::new();
let mut failed_errors: Vec<ValidationError> = Vec::new();
for sub in one_of {
let derived = self.derive_for_schema(sub, true);
@ -28,6 +29,8 @@ impl<'a> ValidationContext<'a> {
.and_then(|id| self.db.depths.get(id).copied())
.unwrap_or(0);
passed_candidates.push((child_id, depth, sub_res));
} else {
failed_errors.extend(sub_res.errors);
}
}
@ -39,6 +42,7 @@ impl<'a> ValidationContext<'a> {
message: "Matches none of oneOf schemas".to_string(),
path: self.path.to_string(),
});
result.errors.extend(failed_errors);
} else {
// Apply depth heuristic tie-breaker
let mut best_depth: Option<usize> = None;