Skip to content

Commit 0474420

Browse files
authored
Merge pull request #579 from jgehrcke/jp/ignore-unknownfields-upon-json-decode
Ignore unknown fields when decoding opaque config JSON documents
2 parents 58b4eda + ec14fa1 commit 0474420

File tree

1 file changed

+8
-1
lines changed
  • api/nvidia.com/resource/v1beta1

1 file changed

+8
-1
lines changed

api/nvidia.com/resource/v1beta1/api.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ func init() {
6969
scheme,
7070
scheme,
7171
json.SerializerOptions{
72-
Pretty: true, Strict: true,
72+
// Note: the strictness applies to all types defined above via
73+
// AddKnownTypes(), i.e. it cannot be set per-type. That is OK in
74+
// this case. Unknown fields will simply be dropped (ignored) upon
75+
// decode, which is what we want. This is relevant in a downgrade
76+
// case, when a checkpointed JSON document contains fields added in
77+
// a later version (workload defined with a new version of this
78+
// driver).
79+
Pretty: true, Strict: false,
7380
},
7481
)
7582
}

0 commit comments

Comments
 (0)