-
Notifications
You must be signed in to change notification settings - Fork 139
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 default value of object within array is not being applied. #515
Comments
First off, thank you for this thorough treatment of the subject, @GrahamDumpleton. 🙏🏻 TL;DR:
The Current PlanThe plan on the books would be to solve this use-case with schema looking something like this:
where:
However, A WorkaroundUntil then, one way to achieve the desired behavior is to wrap it in a function that defaults the values.
which can be then used to ensure the output contains all the desired content:
Clarifying
|
What steps did you take:
Create a directory called
resources
for resource files.In
resources/00-schema.yaml
add:In
resources/01-dummy.yaml
add:Create a
values.yaml
file containing:Run the command:
What happened:
It generates the error:
What did you expect:
Expected it to generate:
Anything else you would like to add:
The problem is triggered due to the use of:
on the
spec
property in the schema file. If you comment out or remove that line you get the desired result.That is, using a schema file of:
gives the expected result.
Trying to reverse the impact of
schema/type any=True
by applyingschema/type any=False
to the nestedstaticPasswords
property doesn't help. That is, following still fails.Even though
schema/type any=True
is used at a higher level in settings hierarchy, would have expected default values to still be applied anduserID
added to object in array even when not supplied.Note that the original intent here was to not fail when unexpected properties were supplied in
spec
for various reasons, but still wanted schema type checks to otherwise apply.For example, didn't want it to fail if was supplied:
which would otherwise yield:
Environment:
ytt --version
):/etc/os-release
):cc @jorgemoralespou
Vote on this request
This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.
👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"
We are also happy to receive and review Pull Requests if you want to help working on this issue.
The text was updated successfully, but these errors were encountered: