Skip to content

Commit d882529

Browse files
committed
Aligning json and yaml errors section
1 parent 1c9a6fd commit d882529

File tree

1 file changed

+21
-2
lines changed
  • keps/sig-api-machinery/2885-server-side-unknown-field-validation

1 file changed

+21
-2
lines changed

keps/sig-api-machinery/2885-server-side-unknown-field-validation/README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,27 @@ we will look into expanding its support of open API to v3, and investigate
303303
whether it makes sense as a permanent solution to client-side validation that
304304
will allow for deprecation of current client-side validation.
305305

306+
##### Aligning json and yaml errors
307+
308+
A few discrepancies between sigs.k8s.io/yaml and sigs.k8s.io/json make detecting
309+
and reporting strict errors inconsistent and should be addressed at some point.
310+
311+
1. sigs.k8s.io/yaml does not currently have a strict unmarshaling mechanism to
312+
distinguish between strict and non-strict errors while sigs.k8s.io/json does.
313+
This results in having to perform unmarshaling twice for yaml data in some
314+
cases.
315+
See [this
316+
discussion](https://github.com/kubernetes/kubernetes/pull/105916#discussion_r748530682) from the the alpha PR and the follow-up [tracking
317+
issue](https://github.com/kubernetes-sigs/yaml/issues/70).
318+
319+
2. kyaml and kjson currently report strict decoding errors in different formats.
320+
For example a duplicate field error appears from kyaml as `line 26: key
321+
"imagePullPolicy" already set in map`, while kjson reports the error as
322+
`duplicate field "spec.template.spec.containers[0].imagePullPolicy"`. For
323+
consistencies sake, these two libraries should eventually report the same
324+
errors in the same format.
325+
326+
306327
<!--
307328
What are the caveats to the proposal?
308329
What are some important details that didn't come across above?
@@ -588,8 +609,6 @@ Below are some examples to consider, in addition to the aforementioned [maturity
588609
- [ ] endpoints handler unit testing of field validation
589610
- [ ] customresource handler unit testing of field validation
590611
- [ ] field validation integration tests check for exact match of strict errors
591-
- [ ] [make
592-
use](https://github.com/kubernetes/kubernetes/pull/105916#discussion_r746125180) of the decoded object rather than decoding multiple times
593612
- [ ]
594613
[decide](https://github.com/kubernetes/kubernetes/pull/105916#discussion_r750769609) whether a fieldValidation=Strict fatal error should return before
595614
an error from the apply operation.

0 commit comments

Comments
 (0)