@schema/default
Annotation
#295
Labels
enhancement
This issue is a feature request
priority/important-soon
Must be staffed and worked on currently or soon.
@schema/default
work is on ytt branch: schema-default
Explicitly sets the default value of the annotated node.
@schema/default value
value
(any exceptfunction
) — the overriding default value.Notes:
value
must be of the type of the annotated node.Narrative:
As a configuration author
I want to explicitly set a default value for a data value
so that I can specify default values for arrays
🍏 Set the default value
Given a document, array item, or map item is annotated with
@schema/default <value>
And the value is of the same type as the key below it
When I run
ytt
that includes that schemaThen that value shows up as the default for that array
Scenario 1: 🍏 Set the default value of an int
Then the result of
ytt -f schema.yml -f template.yml
is:Scenario 2: 🍏 Set the default value of an array
Then the result of
ytt -f schema.yml -f template.yml
is:Scenario 3: 🟥 Keyword argument(s) of incorrect format
Given a document, array item, or map item is annotated with
@schema/default
with any other keyword argument (kwarg) except a value of the same type that is defined inline for arrays or mapsWhen I run
ytt
that includes that schemaThen I see an error message which includes line numbers to help point to where the error is, alongside a helpful message that describes the problem and how to fix it (unknown kwarg, fix by removing or using the only currently supported on, any)
More examples in the original ytt schema doc
Notes:
The text was updated successfully, but these errors were encountered: