Skip to content

Commit a237e1e

Browse files
committed
refactor: Replace panic with pattern match
1 parent 0477fd0 commit a237e1e

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

kube-core/src/schema/transform_any_of.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) fn hoist_any_of_subschema_with_a_nullable_variant(kube_schema: &mut S
2626

2727
let SubschemaValidation {
2828
any_of: Some(any_of),
29-
one_of,
29+
one_of: None,
3030
} = subschemas.deref_mut()
3131
else {
3232
return;
@@ -60,11 +60,6 @@ pub(crate) fn hoist_any_of_subschema_with_a_nullable_variant(kube_schema: &mut S
6060
panic!("the non-null anyOf subschema is a bool. That is not expected here");
6161
};
6262

63-
// There should not be any oneOf's adjacent to the anyOf
64-
if one_of.is_some() {
65-
panic!("oneOf is set when there is already an anyOf: {one_of:#?}");
66-
}
67-
6863
let mut to_hoist = to_hoist.clone();
6964
let kube_schema_metadata = kube_schema.metadata.take();
7065

kube-core/src/schema/transform_one_of.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ pub(crate) fn hoist_one_of_enum_with_unit_variants(kube_schema: &mut SchemaObjec
2828
};
2929

3030
let SubschemaValidation {
31-
one_of: Some(one_of), ..
31+
any_of: None,
32+
one_of: Some(one_of),
3233
} = subschemas.deref_mut()
3334
else {
3435
return;

0 commit comments

Comments
 (0)