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

Edit strict mode to throw errors on additional properties, not found in the schema #234

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

llxp
Copy link

@llxp llxp commented Oct 10, 2023

This pull request changes the strict mode in such a way, that when there are additional properties in the schema, it throws an error.
It sets additional properties to false in the schema, if strict mode is set.
Also introduces an additional parameter to exclude specific properties using a yaml path.
By default, if no exception is set, the metadata property is excluded, as most k8s yaml schemes are missing it and thus would give out false positives.

@llxp llxp marked this pull request as ready for review October 10, 2023 10:11
@yannh
Copy link
Owner

yannh commented Dec 24, 2023

Hi @llxp ! Could you expand how this is different from the current behaviour for kubeconform? It should already mark tests as failed when -strict is set and additional properties are found? See this test:

kubeconform/acceptance.bats

Lines 136 to 139 in 808e6d4

@test "Fail when parsing a config with additional properties and strict set" {
run bin/kubeconform -strict -kubernetes-version 1.20.0 fixtures/extra_property.yaml
[ "$status" -eq 1 ]
}

What exactly are you trying to achieve?

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 this pull request may close these issues.

2 participants