Erik retweeted the following article which explains the issues with the current YAML definition: https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
We should probably take this into account for any successor to the current templates (e.g., use JSON with comments or TOML)
These critics are all valid, but YAML still is more friendly to write in many cases, e.g., if you want to include a paragraph of formatted text. I mentioned (but did not test) YAY before (https://github.com/chetmurthy/yay). YAY claims to be "merely a nicer syntax for writing JSON documents", so it might avoid some of the pitfalls described in this blog post (unclear).
It's funny that the blog post mentions the option of generating JSON from Nix since this is exactly what the Coq Nix Toolbox does to create GitHub Action workflows.
Karl Palmskog said:
Erik retweeted the following article which explains the issues with the current YAML definition: https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
We should probably take this into account for any successor to the current templates (e.g., use JSON with comments or TOML)
@Karl Palmskog, I actually tweeted this blog article more to share a "curiosity" than to suggest there is any concern with YAML!
To sum up: you can check that all gotchas mentioned are just due to the fact the blog author does not properly quote strings (to some extend, he does not write clean YAML :)
The simplest way to exemplify this fact relies on the floating-point interpretation:
If you write
versions:
- 8.10
then 8.10 is seen as a float and subsequently shortened to 8.1 :sweat_smile:
But if you write
versions:
- "8.10"
then there is no issue at all.
So I'm sorry if my remark made you think about we should move away from YAML… I really think that it's a very good data-serialization format, more concise than XML, more readable than JSON, and still robust (much more than CSV for example)
I'm still leaning towards something like YAY for Templates 2.0...
I think the issues with complexity are real, and this is the first time I hear suggestions of quoting all strings — which requires escaping other characters. Many recommend >
, but apparently that adds a newline and you need >-
instead (https://stackoverflow.com/a/22483116/53974).
and if you quote all strings, I wonder if you need all of YAML's complexity?
Last updated: Jun 03 2023 at 18:01 UTC