@@ -61,30 +61,20 @@ pub(crate) fn hoist_properties_for_any_of_subschemas(kube_schema: &mut SchemaObj
6161 . collect :: < Vec < _ > > ( ) ;
6262
6363 for subschema in subschemas {
64- // This will clear out any objects that don't have required/properties fields (so that it
65- // appears as: {}).
66- let metadata = subschema. metadata . take ( ) ;
64+ // Drop the "type" field on subschema. It needs to be set to "object" on the schema.
6765 subschema. instance_type . take ( ) ;
68-
69- // Set the schema type to object
7066 kube_schema. instance_type = Some ( SingleOrVec :: Single ( Box :: new ( InstanceType :: Object ) ) ) ;
7167
68+ // Drop the description for untagged enum variants.
69+ // This (along with the dropping of the "type" above) will allow for empty variants ({}).
70+ if !preserve_description {
71+ subschema. metadata . take ( ) ;
72+ }
73+
7274 if let Some ( object) = subschema. object . as_deref_mut ( ) {
7375 // Kubernetes doesn't allow variants to set additionalProperties
7476 object. additional_properties . take ( ) ;
7577
76- // For a tagged enum (oneOf), we need to preserve the variant description
77- if preserve_description {
78- if let Some ( Schema :: Object ( subschema) ) = object. properties . values_mut ( ) . next ( ) {
79- if let Some ( Metadata {
80- description : Some ( _) , ..
81- } ) = metadata. as_deref ( )
82- {
83- subschema. metadata = metadata
84- }
85- } ;
86- }
87-
8878 // If subschema properties are set, hoist them to the schema properties.
8979 // This will panic if duplicate properties are encountered that do not have the same
9080 // shape. That can happen when the untagged enum variants each refer to structs which
0 commit comments