Skip to content

Commit 39df989

Browse files
committed
chore: fix comments/descriptions in tests
1 parent d0fe594 commit 39df989

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

kube-core/src/schema/transform_optional_enum_with_null.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ pub(crate) fn remove_optional_enum_null_variant(kube_schema: &mut SchemaObject)
5454

5555
// It only makes sense to remove `null` enum values in case the enum is
5656
// nullable (thus optional).
57-
if let Some(Value::Bool(true)) = extensions.get("nullable")
57+
if let Some(Value::Bool(true)) = extensions.get("nullable") {
5858
// Don't remove the single last enum variant. This often happens for
5959
// `Option<XXX>`, which is represented as
6060
// `"anyOf": [XXX, {"enum": [null], "optional": true}]`
61-
&& enum_values.len() > 1 {
61+
if enum_values.len() > 1 {
6262
enum_values.retain(|enum_value| enum_value != &Value::Null);
63+
}
6364
}
6465
}

kube-derive/tests/crd_complex_enum_tests.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde_json::json;
77

88
// Enum definitions
99

10-
/// A very simple enum with empty variants
10+
/// A very simple enum with unit variants
1111
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
1212
enum NormalEnum {
1313
/// First variant
@@ -31,7 +31,10 @@ pub enum NormalEnumWithoutDescriptions {
3131
/// A complex enum with unit and struct variants
3232
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
3333
enum ComplexEnum {
34+
/// Override documentation on the Normal variant
3435
Normal(NormalEnum),
36+
37+
/// Documentation on the Hardcore variant
3538
Hardcore {
3639
hard: String,
3740
core: NormalEnum,
@@ -43,7 +46,7 @@ enum ComplexEnum {
4346
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
4447
#[serde(untagged)]
4548
enum UntaggedEnum {
46-
/// Used in case the `one` field of tpye [`u32`] is present
49+
/// Used in case the `one` field of type [`u32`] is present
4750
A { one: String },
4851
/// Used in case the `two` field of type [`NormalEnum`] is present
4952
B { two: NormalEnum },
@@ -192,7 +195,7 @@ fn normal_enum() {
192195
"spec": {
193196
"properties": {
194197
"foo": {
195-
"description": "A very simple enum with empty variants",
198+
"description": "A very simple enum with unit variants",
196199
"enum": [
197200
"C",
198201
"D",
@@ -258,7 +261,7 @@ fn optional_enum() {
258261
"spec": {
259262
"properties": {
260263
"foo": {
261-
"description": "A very simple enum with empty variants",
264+
"description": "A very simple enum with unit variants",
262265
"enum": [
263266
"C",
264267
"D",
@@ -482,7 +485,7 @@ fn untagged_enum() {
482485
"type": "string"
483486
},
484487
"two": {
485-
"description": "A very simple enum with empty variants",
488+
"description": "A very simple enum with unit variants",
486489
"enum": [
487490
"C",
488491
"D",
@@ -571,7 +574,7 @@ fn optional_untagged_enum() {
571574
"type": "string"
572575
},
573576
"two": {
574-
"description": "A very simple enum with empty variants",
577+
"description": "A very simple enum with unit variants",
575578
"enum": [
576579
"C",
577580
"D",
@@ -656,7 +659,7 @@ fn flattened_untagged_enum() {
656659
"type": "string"
657660
},
658661
"two": {
659-
"description": "A very simple enum with empty variants",
662+
"description": "A very simple enum with unit variants",
660663
"enum": [
661664
"C",
662665
"D",

0 commit comments

Comments
 (0)