Skip to content

Commit d0fe594

Browse files
committed
chore: fix comments, use iter_mut
1 parent ef6da4f commit d0fe594

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

kube-core/src/schema/transform_any_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ fn optional_tagged_enum_with_unit_variants() {
9191
///
9292
/// This will return early without modifications unless:
9393
/// - There are exactly 2 `anyOf` subschemas.
94-
/// - One subschema represents the nullability (ie: it has an enum with a single
95-
/// null entry, and nullable set to true).
94+
/// - One subschema represents the nullability (ie: it has an `enum` with a single
95+
/// `null` entry, and `nullable` set to true).
9696
///
9797
/// NOTE: This should work regardless of whether other hoisting has been performed or not.
9898
pub(crate) fn hoist_any_of_subschema_with_a_nullable_variant(kube_schema: &mut SchemaObject) {

kube-core/src/schema/transform_one_of.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ pub(crate) fn hoist_one_of_enum_with_unit_variants(kube_schema: &mut SchemaObjec
128128
})
129129
.collect::<Vec<_>>();
130130

131-
// If there are no enums in the oneOf subschemas, there is nothing more to do here.
131+
// If there are no enums (or consts converted to enums) in the oneOf subschemas, there is nothing more to do here.
132+
// For example, when the schema has `properties` and `required`, so we leave that for the properties hoister.
132133
if new_enums.is_empty() {
133134
return;
134135
}

kube-core/src/schema/transform_properties.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn untagged_enum_with_empty_variant_before_one_of_hoisting() {
2626
],
2727
"properties": {
2828
"two": {
29-
"description": "A very simple enum with empty variants",
29+
"description": "A very simple enum with unit variants",
3030
"oneOf": [
3131
{
3232
"type": "string",
@@ -81,7 +81,7 @@ fn untagged_enum_with_empty_variant_before_one_of_hoisting() {
8181
"type": "string"
8282
},
8383
"two": {
84-
"description": "A very simple enum with empty variants",
84+
"description": "A very simple enum with unit variants",
8585
"oneOf": [
8686
{
8787
"type": "string",
@@ -241,7 +241,7 @@ fn invalid_untagged_enum_with_conflicting_variant_fields_before_one_of_hosting()
241241
],
242242
"properties": {
243243
"two": {
244-
"description": "A very simple enum with empty variants",
244+
"description": "A very simple enum with unit variants",
245245
"oneOf": [
246246
{
247247
"type": "string",
@@ -315,7 +315,7 @@ fn invalid_untagged_enum_with_conflicting_variant_fields_after_one_of_hosting()
315315
],
316316
"properties": {
317317
"two": {
318-
"description": "A very simple enum with empty variants",
318+
"description": "A very simple enum with unit variants",
319319
"type": "string",
320320
"enum": [
321321
"C",
@@ -400,7 +400,7 @@ pub(crate) fn hoist_properties_for_any_of_subschemas(kube_schema: &mut SchemaObj
400400
// TODO (@NickLarsenNZ): Return errors instead of panicking, leave panicking up to the infallible schemars::Transform
401401

402402
let subschemas = subschemas
403-
.into_iter()
403+
.iter_mut()
404404
.map(|schema| match schema {
405405
Schema::Object(schema_object) => schema_object,
406406
Schema::Bool(_) => panic!("oneOf and anyOf variants cannot be of type boolean"),

0 commit comments

Comments
 (0)