Documentation for version v0.41.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.
Strict YAML
Overview ¶
ytt includes strict YAML subset mode that tries to remove any kind of ambiguity in user’s intent when parsing YAML.
Unlike full YAML, strict subset:
- only supports specifying nulls as "" or
null
- only supports specifying bools as
false
ortrue
- only support basic int and float declarations
- prefix, suffix, octal notation, etc are not supported
- requires strings with whitespace to be explicitly quoted
- requires strings with colon to be explicitly quoted
- requires strings with triple-dash (document start) to be explicitly quoted
Example ¶
Non-strict:
$ echo 'key: yes' | ytt -f-
key: true
Strict:
$ echo 'key: yes' | ytt -f- -s
Error: Unmarshaling YAML template 'stdin.yml': yaml: Strict parsing: Found 'yes' ambigious (could be !!str or !!bool)
To fix error, explicitly make it a string:
$ echo 'key: "yes"' | ytt -f- -s
key: "yes"
or via YAML tag !!str
:
$ echo 'key: !!str yes' | ytt -f- -s
key: "yes"
(Help improve our docs: edit this page on GitHub)