Skip to content

Commit 9acd912

Browse files
Update crates/stackable-versioned-macros/src/codegen/container/struct/k8s.rs
Co-authored-by: Nick <[email protected]>
1 parent 95a10ae commit 9acd912

File tree

1 file changed

+5
-3
lines changed
  • crates/stackable-versioned-macros/src/codegen/container/struct

1 file changed

+5
-3
lines changed

crates/stackable-versioned-macros/src/codegen/container/struct/k8s.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,11 @@ impl Struct {
186186
.as_str()
187187
.ok_or_else(|| #parse_object_error::FieldNotStr{ field: "kind".to_string() })?;
188188

189-
// Note(@sbernauer): One could argue we don't need to check the kind, but this
190-
// is a nice sanity check. If for *some* reason a unexpected kind ends up at a
191-
// conversion, the problem might be very hard to spot without this.
189+
// Note(@sbernauer): The kind must be checked here, because it is
190+
// possible for the wrong object to be deserialized.
191+
// Checking here stops us assuming the kind is correct and
192+
// accidentally updating upgrade/downgrade information in the
193+
// status in a later step.
192194
if object_kind != stringify!(#enum_ident) {
193195
return Err(#parse_object_error::UnexpectedObjectKind{
194196
kind: object_kind.to_string(),

0 commit comments

Comments
 (0)