Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object with required fields can be null #25

Open
yannh opened this issue Oct 16, 2020 · 1 comment
Open

Object with required fields can be null #25

yannh opened this issue Oct 16, 2020 · 1 comment

Comments

@yannh
Copy link

yannh commented Oct 16, 2020

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:

"required": [
"apiVersion",
"kind",
"name",
"uid"
],
"type": [
"object",
"null"
],

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?

@jcmcken
Copy link

jcmcken commented Jan 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants