Documentation for version v0.42.0 is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
Schema Validations Cheat Sheet
Use Case | Syntax | Required string | #@schema/validation min_len=1
username: ""
|
Required integer | #@schema/validation min=1
replicas: 0
|
Required array | #@schema/validation min_len=1
responseTypes:
- ""
|
Required map | #@schema/nullable
#@schema/validation not_null=True
credential:
name: ""
cloud: ""
|
Ensure string minimum length | #@schema/validation min_len=8
password: ""
|
Ensure string exact length | #@schema/validation min_len=8, max_len=8
password: ""
|
Ensure a min value | #@schema/validation min=3
replicas: 5
|
Ensure a max value | #@schema/validation max=5
replicas: 3
|
Ensure a value between min and max | #@schema/validation min=1, max=65535
port: 1024
|
Enumeration | #@schema/validation one_of=["aws", "azure", "vsphere"]
provider: ""
|
Exactly one is specified (mutually exclusive config) | #@schema/validation one_not_null=["oidc", "ldap"]
config:
#@schema/nullable
oidc:
client_id: “”
#@schema/nullable
ldap:
host: “”
|
Conditionally run validations | #@ load("@ytt:assert", "assert")
#@ isLoadBalancer = lambda v: v["type"] == "LoadBalancer"
#@ assertNameGiven = ("be given", lambda v: assert.min_len(1).check(v["name"]))
#@data/values-schema
---
#@schema/validation assertNameGiven, when=isLoadBalancer
service:
type: LoadBalancer
name: ""
|
Custom description of valid value | #@ load("@ytt:assert", "assert")
#@schema/validation ("a non-blank name", assert.min_len(1))
username: ""
|
Disable validations flag | $ ytt ... --dangerous-data-values-disable-validation
|