You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Narrative: As a configuration author I want to ensure a field exists in my data values, regardless of type so that tooling can rely on its existence, and we can support multi-typed items like "intOrString"s
🟢 Any Type Allowed
Given a document, array item, or map item is annotated with @schema/type any=True And the value for that node is any value (including null) When I run ytt that includes that schema Then that value passes validation
Then the result of ytt -f schema.yml -f dv.yml -f template.yml --enable-experiment-schema is:
---
foo: 13.5bar: ["", 0, True]baz: null
(without an error)
🟢 Any Type Not Allowed
Given a document, array item, or map item is annotated with @schema/type any=False When I run ytt that includes that schema Then (it should behave exactly as if the annotation were not present)
Given a document, array item, or map item is annotated with @schema/type with any other keyword argument (kwarg) except any=[True,False] When I run ytt that includes that schema Then 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)
Document on line schema.yml:3:
Map item (key 'foo') on line schema.yml:5:
Unknown 'schema/type' annotation keyword argument 'unknown_kwarg'. Supported kwargs are 'any'
🔴 Values for any other than a boolean
Given a document, array item, or map item is annotated with @schema/type with any keyword argument with value except [True,False] When I run ytt that includes that schema Then 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 (any kwarg must be a boolean, fix by setting to True or False)
Document on line schema.yml:3:
Map item (key 'foo') on line schema.yml:5:
Expected 'schema/type' annotation keyword argument 'any' to be a boolean, but was '3.5'.
📚 Documentation: Navigation
Given I want to learn how to mark a node in a schema as accepting any type of value When I navigate through ytt documentation Then I intuitively find the reference that describes the @schema/type annotation.
🔍 Documentation: Search
Given I want to learn how to mark a node in a schema as accepting any type of value When I search for the most obvious search terms: "schema", "any", "types" Then I see results that when I click on them take me to the most relevant reference for this annotation.
Implementation Notes
it would be lovely if we could replace the AnySchema type with a DocumentSchema that contains a Document node of type Any
Notes
Adding the any annotation does not relax the constraints of the schema; they must continue to be well-formed. Arrays must have a single item with a type, and nulls aren't permitted as values. (after talking this over with @gcheadle-vmware, we saw no reason to maintain a this limitation, and saw value in allowing it)
The text was updated successfully, but these errors were encountered:
Narrative:
As a configuration author
I want to ensure a field exists in my data values, regardless of type
so that tooling can rely on its existence, and we can support multi-typed items like "intOrString"s
🟢 Any Type Allowed
Given a document, array item, or map item is annotated with
@schema/type any=True
And the value for that node is any value (including null)
When I run
ytt
that includes that schemaThen that value passes validation
Then the result of
ytt -f schema.yml -f dv.yml -f template.yml --enable-experiment-schema
is:(without an error)
🟢 Any Type Not Allowed
Given a document, array item, or map item is annotated with
@schema/type any=False
When I run
ytt
that includes that schemaThen (it should behave exactly as if the annotation were not present)
(success)
(error)
🔴 Keyword argument(s) other than
any
specifiedGiven a document, array item, or map item is annotated with
@schema/type
with any other keyword argument (kwarg) exceptany=[True,False]
When 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)
🔴 Values for
any
other than a booleanGiven a document, array item, or map item is annotated with
@schema/type
withany
keyword argument with value except[True,False]
When 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 (
any
kwarg must be a boolean, fix by setting to True or False)📚 Documentation: Navigation
Given I want to learn how to mark a node in a schema as accepting any type of value
When I navigate through
ytt
documentationThen I intuitively find the reference that describes the
@schema/type
annotation.🔍 Documentation: Search
Given I want to learn how to mark a node in a schema as accepting any type of value
When I search for the most obvious search terms: "schema", "any", "types"
Then I see results that when I click on them take me to the most relevant reference for this annotation.
Implementation Notes
AnySchema
type with aDocumentSchema
that contains a Document node of typeAny
Notes
Adding the any annotation does not relax the constraints of the schema; they must continue to be well-formed. Arrays must have a single item with a type, and
nulls aren't permitted as values.(after talking this over with @gcheadle-vmware, we saw no reason to maintain a this limitation, and saw value in allowing it)The text was updated successfully, but these errors were encountered: