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

Allow values with null values during the schema generation #31

Closed
antgamdia opened this issue Feb 16, 2022 · 1 comment · Fixed by #33
Closed

Allow values with null values during the schema generation #31

antgamdia opened this issue Feb 16, 2022 · 1 comment · Fixed by #33

Comments

@antgamdia
Copy link

Context: json-schema does not apply any restrictions on the default field, but openapi schema does. Specifically, they say "the value MUST conform to the defined type for the Schema Object".

I assume this is the reason why this check is there. However, if the nullable: true is passed, the null value is allowed. Spec here. Issue here

Shouldn't we just add nullable: true when a null property is detected?
At least, I don't think we should throw an error.

Example:

## @section kubeappsapis parameters
kubeappsapis:
  pluginConfig:
    kappController:
      packages:
        v1alpha1:
          ## @param kubeappsapis.pluginConfig.kappController.packages.v1alpha1.defaultPrereleasesVersionSelection Default policy for allowing prereleases containing one of the identifiers
          ## ref: https://carvel.dev/kapp-controller/docs/latest/package-consumer-concepts/#prereleases
          ## e.g:
          # defaultPrereleasesVersionSelection: 
          # - rc
          defaultPrereleasesVersionSelection: null
{
  name: 'kubeappsapis.pluginConfig.kappController.packages.v1alpha1.defaultPrereleasesVersionSelection',
  value: 'null',
  description: 'Default policy for allowing prereleases containing one of the identifiers',
  section: 'kubeappsapis parameters',
  type: 'object',
  nullable: true
}
@miguelaeh
Copy link
Contributor

Thank you @antgamdia for reporting this.

I think we can move the check of the null parameters to the metadata checks and allow setting null as a value.
The error was set for the case in which there is not a default value at all on one property but looks like for some reason null is also considered as if there were no value.

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

Successfully merging a pull request may close this issue.

2 participants