@@ -35,7 +35,8 @@ pub(crate) fn hoist_properties_for_any_of_subschemas(kube_schema: &mut SchemaObj
3535 return ;
3636 }
3737
38- // Ensure we aren't looking at the one with a null, as that is hoisted by another transformer
38+ // Ensure we aren't looking at the subschema with a null, as that is hoisted by another
39+ // transformer.
3940 if subschemas. len ( ) == 2 {
4041 // Return if there is a null entry
4142 if subschemas
@@ -47,7 +48,7 @@ pub(crate) fn hoist_properties_for_any_of_subschemas(kube_schema: &mut SchemaObj
4748 }
4849 }
4950
50- // At this point, we can be reasonably sure we need operate on the schema.
51+ // At this point, we can be reasonably sure we need to operate on the schema.
5152 // TODO (@NickLarsenNZ): Return errors instead of panicking, leave panicking up to the
5253 // infallible schemars::Transform
5354
@@ -84,19 +85,18 @@ pub(crate) fn hoist_properties_for_any_of_subschemas(kube_schema: &mut SchemaObj
8485 } ;
8586 }
8687
87- // If properties are set, hoist them to the schema properties.
88+ // If subschema properties are set, hoist them to the schema properties.
8889 // This will panic if duplicate properties are encountered that do not have the same
8990 // shape. That can happen when the untagged enum variants each refer to structs which
9091 // contain the same field name but with different types or doc-comments.
9192 // The developer needs to make them the same.
92- // TODO (@NickLarsenNZ): Add a case for a structural variant, and a tuple variant
93- // containing a structure where the same field name is used.
9493 while let Some ( ( property_name, Schema :: Object ( property_schema_object) ) ) =
9594 object. properties . pop_first ( )
9695 {
9796 // This would check that the variant property (that we want to now hoist)
9897 // is exactly the same as what is already hoisted (in this function).
9998 if let Some ( existing_property) = parent_object
99+ // get the `ObjectValidation`, or an empty one without any properties set
100100 . get_or_insert_default ( )
101101 . properties
102102 . get ( & property_name)
0 commit comments