Skip to content

Commit

Permalink
Merge pull request #124 from negz/rejection
Browse files Browse the repository at this point in the history
Reject unknown fields when converting from Struct to Object
  • Loading branch information
negz authored Feb 21, 2024
2 parents f1c048d + 48e6829 commit 9a5beef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func AsObject(s *structpb.Struct, o runtime.Object) error {
if err != nil {
return errors.Wrapf(err, "cannot marshal %T to JSON", s)
}
return errors.Wrapf(json.Unmarshal(b, o), "cannot unmarshal JSON from %T into %T", s, o)
return errors.Wrapf(json.Unmarshal(b, o, json.RejectUnknownMembers(true)), "cannot unmarshal JSON from %T into %T", s, o)
}

// AsStruct gets the supplied struct from the supplied Kubernetes object.
Expand Down

0 comments on commit 9a5beef

Please sign in to comment.