validation progress
This commit is contained in:
@ -185,9 +185,9 @@ impl<'a> Compiler<'a> {
|
||||
select_args.append(&mut poly_args);
|
||||
|
||||
let jsonb_obj_sql = if select_args.is_empty() {
|
||||
"jsonb_build_object()".to_string()
|
||||
"jsonb_strip_nulls(jsonb_build_object())".to_string()
|
||||
} else {
|
||||
format!("jsonb_build_object({})", select_args.join(", "))
|
||||
format!("jsonb_strip_nulls(jsonb_build_object({}))", select_args.join(", "))
|
||||
};
|
||||
|
||||
// 3. Build WHERE clauses
|
||||
@ -325,7 +325,7 @@ impl<'a> Compiler<'a> {
|
||||
}
|
||||
build_args.push(format!("'{}', {}", k, child_sql));
|
||||
}
|
||||
let combined = format!("jsonb_build_object({})", build_args.join(", "));
|
||||
let combined = format!("jsonb_strip_nulls(jsonb_build_object({}))", build_args.join(", "));
|
||||
Ok((combined, "object".to_string()))
|
||||
}
|
||||
|
||||
|
||||
@ -3623,6 +3623,18 @@ fn test_pattern_1_0() {
|
||||
crate::tests::runner::run_test_case(&path, 1, 0).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invoice_0_0() {
|
||||
let path = format!("{}/fixtures/invoice.json", env!("CARGO_MANIFEST_DIR"));
|
||||
crate::tests::runner::run_test_case(&path, 0, 0).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invoice_0_1() {
|
||||
let path = format!("{}/fixtures/invoice.json", env!("CARGO_MANIFEST_DIR"));
|
||||
crate::tests::runner::run_test_case(&path, 0, 1).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_max_properties_0_0() {
|
||||
let path = format!("{}/fixtures/maxProperties.json", env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user