Skip to content

Commit 4668b97

Browse files
committed
chore: Fix tests after merge
1 parent 2e0a7aa commit 4668b97

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

kube-core/src/schema/transform_properties.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ pub(crate) fn hoist_properties_for_any_of_subschemas(kube_schema: &mut SchemaObj
433433
.next()
434434
.expect("asserted that one and only one property exists")
435435
{
436-
assert!(
437-
// While possible, it is unexpected if the subschema metadata is already set for the property
438-
subschema.metadata.is_none(),
439-
"subschema metadata for property should be empty"
440-
);
441-
// Move the variant description down to the properties (before they get hoisted)
442-
subschema.metadata = metadata
436+
if let Some(Metadata {
437+
description: Some(_d),
438+
..
439+
}) = metadata.as_deref()
440+
{
441+
subschema.metadata = metadata
442+
}
443443
};
444444
}
445445

kube-derive/tests/crd_complex_enum_tests.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub enum NormalEnumWithoutDescriptions {
2828
D,
2929
}
3030

31-
/// A complex enum with unit and struct variants
31+
/// A complex enum with tuple and struct variants
3232
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
3333
enum ComplexEnum {
3434
/// Override documentation on the Normal variant
@@ -484,11 +484,21 @@ fn complex_enum() {
484484
},
485485
"hard": {
486486
"type": "string"
487+
},
488+
"without_description": {
489+
"enum": [
490+
"A",
491+
"B",
492+
"C",
493+
"D"
494+
],
495+
"type": "string"
487496
}
488497
},
489498
"required": [
490499
"core",
491-
"hard"
500+
"hard",
501+
"without_description"
492502
],
493503
"type": "object"
494504
},
@@ -593,11 +603,21 @@ fn optional_complex_enum() {
593603
},
594604
"hard": {
595605
"type": "string"
606+
},
607+
"without_description": {
608+
"enum": [
609+
"A",
610+
"B",
611+
"C",
612+
"D"
613+
],
614+
"type": "string"
596615
}
597616
},
598617
"required": [
599618
"core",
600-
"hard"
619+
"hard",
620+
"without_description"
601621
],
602622
"type": "object"
603623
},

0 commit comments

Comments
 (0)