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

setting additionalProperties recursive #95

Closed
MrFreezeDZ opened this issue Oct 16, 2024 · 4 comments · Fixed by #97
Closed

setting additionalProperties recursive #95

MrFreezeDZ opened this issue Oct 16, 2024 · 4 comments · Fixed by #97
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@MrFreezeDZ
Copy link

MrFreezeDZ commented Oct 16, 2024

When running the schema-executable, the additionalProperties: false is not set for all properties. The only way I saw to set this is by the parameter -schemaRoot.additionalProperties false. This sets it only on the root properties. Is there any way to be able to let the schema-executable set additionalProperties: false for all nested properties without setting an annotation on each property?

@losisin
Copy link
Owner

losisin commented Oct 16, 2024

I'm afraid no. At least not at this point. There was PR for that but seemed too strict. See #39

@MrFreezeDZ
Copy link
Author

I looked over the PR, and the discussion here #38.
In my case this strictness would be exactly what I am looking for. This would even prevent typos when setting values. So a values.schema.json which contains additionalProperties=false recursive on every object would be a nice feature for me.
In the case of an umbrella-helm-chart where the umbrella-chart has multiple dependencies and the author of the umbrella-chart does not maintain the dependencies it would be a nice feature to create the values.schema.json with additonalProperties=false on every object. This would make sure that key changes in one sub values.yaml could be identified automatically.

@pascal-hofmann
Copy link
Contributor

Hi,
first of all: Thanks for this awesome tool!

I agree with @MrFreezeDZ and think there should be an option to enable additionalProperties=false for all objects. It is required to get a very strict schema, but it's very tedious to add it to every object manually via comment.

@losisin Would you accept a PR that adds this feature?

Cheers
Pascal

@losisin
Copy link
Owner

losisin commented Oct 24, 2024

@MrFreezeDZ thanks for the feedback and the suggestion. Sounds reasonable to me and obviously there is interest for that.
@pascal-hofmann pull request would be more than welcome and very much appreciated. I'm thinking command line flag like in the original PR noAdditionalProperties which would change default behaviour from true to false. For backwards compatibility, schemaRoot.additionalProperties and annotation in yaml should take precedence and overwrite the default behaviour whichever it may be. Don't forget tests and updating documentation accordingly and we'll be good to go :)

@losisin losisin added enhancement New feature or request help wanted Extra attention is needed labels Oct 24, 2024
pascal-hofmann added a commit to pascal-hofmann/helm-values-schema-json that referenced this issue Oct 24, 2024
This will default `additionalProperties` to `false` for all objects in the schema if set to `true`.
The `additionalProperties` annotation, `schemaRoot.additionalProperties` and additionalProperties
set via other ways (nested in `itemProperties`, `patternProperties` or similar) will take
precedence over this setting, so it's fully backwards compatible.

Closes losisin#95.
pascal-hofmann added a commit to pascal-hofmann/helm-values-schema-json that referenced this issue Oct 24, 2024
This will default `additionalProperties` to `false` for all objects in the schema if set to `true`.
The `additionalProperties` annotation, `schemaRoot.additionalProperties` and additionalProperties
set via other ways (nested in `itemProperties`, `patternProperties` or similar) will take
precedence over this setting, so it's fully backwards compatible.

Closes losisin#95.
pascal-hofmann added a commit to pascal-hofmann/helm-values-schema-json that referenced this issue Oct 24, 2024
This will default `additionalProperties` to `false` for all objects in the schema if set to `true`.
The `additionalProperties` annotation, `schemaRoot.additionalProperties` and additionalProperties
set via other ways (nested in `itemProperties`, `patternProperties` or similar) will take
precedence over this setting, so it's fully backwards compatible.

Closes losisin#95.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants