Skip to content

Commit 6c59eec

Browse files
committed
fill subschemas on length mismatch
1 parent ff64716 commit 6c59eec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/diff_walker.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ impl DiffWalker {
2727
if let (Some(lhs_any_of), Some(rhs_any_of)) =
2828
(&mut lhs.subschemas().any_of, &mut rhs.subschemas().any_of)
2929
{
30-
lhs_any_of.sort_by_cached_key(|x| format!("{x:?}"));
31-
rhs_any_of.sort_by_cached_key(|x| format!("{x:?}"));
30+
match (lhs_any_of.len(), rhs_any_of.len()) {
31+
(l, r) if l <= r => {
32+
lhs_any_of.append(&mut vec![Schema::Object(SchemaObject::default()); r - l]);
33+
}
34+
(l, r) => {
35+
rhs_any_of.append(&mut vec![Schema::Object(SchemaObject::default()); l - r]);
36+
}
37+
}
3238

3339
for (i, (lhs_inner, rhs_inner)) in
3440
lhs_any_of.iter_mut().zip(rhs_any_of.iter_mut()).enumerate()

0 commit comments

Comments
 (0)