Closed alexzielenski closed 1 year ago
/approve /lgtm
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: alexzielenski, apelisse Once this PR has been reviewed and has the lgtm label, please assign liggitt for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Am not convinced of this. Everywhere in kube we have the convention that JSON unstructured data must be well-typed. []string
is not a valid JSON type. Extending this function here IMO just hides errors. The right solution is to fix ConvertJSONSchemaPropsWithPostProcess
. I wished Go was able express this invariant 🤷♂️
https://github.com/kubernetes/kubernetes/blob/2a91bd1dfdd2e293b9ec017ea3a976ecc2ecd545/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go#L614 has the definition of what valid JSON values are in kube code.
/close
in favor of changing ConvertJSONSchemaPropsWithPostProcess
@alexzielenski: Closed this PR.
makes GetStringSlice support slices of strings
ConvertJSONSchemaPropsWithPostProcess in k/k directly places its []string of x-kubernetes-list-map-keys into the extensions map, which are then used with validation code.
Running into this problem of
GetStringSlice
not seeing the MapKeys added by this function, since they are[]string
and it only supports[]interface{}
Adding this logic alleviates the issue and makes the implementation match the expected behavior of the function
/cc @apelisse