kubernetes-json-schema icon indicating copy to clipboard operation
kubernetes-json-schema copied to clipboard

Object with required fields can be null

Open yannh opened this issue 3 years ago • 1 comments

Some objects with fields marked as required can be null, if I understand this correctly this should not be the case and can result in JSONs missing required fields being marked as valid.

For example this here: https://github.com/instrumenta/kubernetes-json-schema/blob/133f84871ccf6a7a7d422cc40e308ae1c044c2ab/v1.17.0-standalone-strict/cronjob.json#L220-L229

I believe it might come from this line https://github.com/instrumenta/openapi2jsonschema/blob/d697cbff8a25f520e125e3a5f79cb4e9b972e8ce/openapi2jsonschema/util.py#L67 - I am not sure to understand why the last condition is there?

yannh avatar Oct 16 '20 22:10 yannh

We also have this issue, and our users are hitting this problem often. kubeval allows a config file to pass that, for example, will panic Kustomize or fail if you try to kubectl apply it. Kustomize, for its own part, does not have a very good error message when it has problems like this. But it seems strange to allow null values for fields which in the upstream API spec must take values.

jcmcken avatar Jan 16 '21 00:01 jcmcken