YAML has become the de-facto standard to express resources in many fields linked to DevOps practices. What are YAML’s strengths and weaknesses, and what are the other options going forward?
7. YAML’s qualities
■ Easy to read by humans
■ Easy to parse by machines
■ Can be used for simple configurations (conf files)
■ Can be used to store data (e.g. Puppet’s Hiera)
8.
9. A bit of history
■ 1999: XML + XSLT
■ 2001: YAML
■ 2002: JSON
(Javascript Object Notation)
10. YAML != XML
■ YAML Ain’t Markup Language
■ Serialization format
■ Maps to Hashes/Arrays
13. Data Types
■ YAML has (loose) data types
■ Some languages (e.g. Ruby) dynamically
load types as classes:
[10] pry(main)> Puppet.settings.to_yaml.split("n").first
=> "--- &1 !ruby/object:Puppet::Settings"
■ Security problem
25. YAML is data, not code
“Nobody will ever want to program
in YAML and Jinja.”
Adam Jacob
26. In Kubernetes
■ June 2014:
YAML added as
an alternative to JSON
■ Server starts accepting
YAML
■ Expected to be a
temporary solution
https://www.youtube.com/watch?v=8PpgqEqkQWA
27. A bit of history (continued)
■ 1999: XML + XSLT
■ 2001: YAML
■ 2002: JSON (Javascript Object Notation)
■ 2014: Jsonnet
■ 2019: Google CUE + YTT
■ 2020: Dhall
28. Generating YAML (or JSON)
■ Most languages can output YAML/JSON
■ But we want declarative code!
■ Avoid imperative coding as much as possible, if possible
make it impossible.
33. Dhall
■ Programmable configuration language
■ JSON + functions + types + imports
■ Based on Haskell
■ Not Turing-complete
guaranteed to return
https://dhall-lang.org