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

Schema conversion conflates "optional field" with "allowing null values" #44

Open
jcmcken opened this issue Jan 16, 2021 · 0 comments
Open

Comments

@jcmcken
Copy link

jcmcken commented Jan 16, 2021

Similar issue was reported here but this might be a better home for it, not sure.

In this code the tool conflates an optional field (i.e. a field that does not have to be specified) with a field that allows null values. But this is not correct and these are distinct things in some cases (e.g. Kubernetes schemas)

As a real world example, if you have a Kubernetes Deployment and set a secret volume like this (with secretName having the null value)...

...
spec:
  volumes:
    - name: somevol
      secret:
        secretName:
...

The schema produced from openapi2jsonschema using kubeval will happily consider this config valid. But if you try to apply the config using kubectl or kustomize, it complains that secretName cannot take a null value. And indeed if you look at the upstream schema, nowhere does it specify that the field is nullable.

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

1 participant