Skip to content

Commit 77af8e5

Browse files
committed
chore(kube-core): Add further explanation about why the types must be the same
1 parent 6eb14fc commit 77af8e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kube-core/src/schema/transform_one_of.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ fn hoist_one_of_enum_with_unit_variants(kube_schema: &mut SchemaObject) {
8080
Schema::Bool(_) => panic!("oneOf variants can not be of type boolean"),
8181
});
8282

83-
// Get the first type
83+
// Get the first type...
8484
let variant_type = types.next().expect("at this point, there must be a type");
85-
// Ensure all variant types match it
85+
// ... and ensure all variant types match it.
86+
// This is needed because the individual subschema enums (each with their own type field)
87+
// will be combined into one enum with one type field.
8688
if types.any(|r#type| r#type != variant_type) {
8789
panic!("oneOf variants must all have the same type");
8890
}

0 commit comments

Comments
 (0)