As others in this thread have said: I ask this question all the time, except s/templating/using/. YAML is insanely over complicated; it's as bad or worse than XML for config files, and it doesn't even have the nice streaming mode. Not to mention that it's a bit of a security nightmare (seriously, who put pointers into the YAML spec?). And, on a more subjective note, YAML is just confusing: between all the significant…
Why are we templating YAML?
121–130 of 351 posts
Re: Why are we templating YAML?
#122Earlier quoted context omitted.
The killer feature for me over JSON is comment support, it's definitely useful to add todo comments etc.
Yeah this is a huge selling point of YAML. JSON should have comments added to the spec. The other benefit to YAML is human readability, which is usually better in YAML compared to JSON. A specific glaring example of this is when there are long string-literal snippets inside the document, in YAML this is massively more readable than in JSON.
See also ~5 years ago: https://news.ycombinator.com/item?id=7325735
Re: Why are we templating YAML?
#123Earlier quoted context omitted.
The killer feature for me over JSON is comment support, it's definitely useful to add todo comments etc.
You can just use JSON with comments though. If you have sufficient control over the technology in question to be able to completely change it to a YAML parser, surely you can change it to be a JSON+Comment parser too. See: VS Code's config files.
Re: Why are we templating YAML?
#124Earlier quoted context omitted.
>> I really dislike YAML I wasn’t aware anyone liked it
Tools keep using it even where it's the wrong tool for the job, so someone must like it, surely? I'm sure it will be just like XML where it's the trendy thing for a while in the early days, then everyone stops and hates it for a while. Except XML at least has a handful of applications where it's the right tool for the job (it has a nice streaming mode), YAML doesn't even have that.
Opting for YAML over XML/JSON/whatever doesn't make me a tool. It made life much easier for myself & my colleagues.
Re: Why are we templating YAML?
#125Earlier quoted context omitted.
What is up with the strange comma positioning? I assume that’s just a stylistic choice?
It allows each line to be completely independent of it’s neighbors; you can comment and/or add lines without needing to touch neighboring lines. Also, it makes it visually easy to spot missing commas. Give it a try sometime, it’s actually quite nice.
Re: Why are we templating YAML?
#126Earlier quoted context omitted.
>it's as bad or worse than XML for config files XML works very well for config files. It's schema-optional (but is there), well-specified, human-readable, has plethora of supporting technologies (making things like templating easy), and is well supported by every language. At the very least it is way better than JSON.
It's missing one important part for config files. It's tedious to write by hand.
Re: Why are we templating YAML?
#127I know I'm in a minority, but I really dislike YAML... I recently did a lot of Ansible and boy, at the beginning, I was just struggling a lot. Syntactic whitespace kills me. I don't like it in Python either, but for some reason, when I write Python, it's a lot easier. Maybe YAML is just a bit more complex (and Python has better IDE support..?)
Re: Why are we templating YAML?
#128My belief is that we've been slowly building up to using general purpose languages, one small step at a time, throughout the infrastructure as code, DevOps, and SRE journeys this past 10 years. INI files, XML, JSON, and YAML aren't sufficiently expressive -- lacking for loops, conditionals, variable references, and any sort of abstraction -- so, of course, we add templates to it. But as the author (IMHO rightfully) p…
Re: Why are we templating YAML?
#129My belief is that we've been slowly building up to using general purpose languages, one small step at a time, throughout the infrastructure as code, DevOps, and SRE journeys this past 10 years. INI files, XML, JSON, and YAML aren't sufficiently expressive -- lacking for loops, conditionals, variable references, and any sort of abstraction -- so, of course, we add templates to it. But as the author (IMHO rightfully) p…
Re: Why are we templating YAML?
#130Earlier quoted context omitted.
What is up with the strange comma positioning? I assume that’s just a stylistic choice?
It allows each line to be completely independent of it’s neighbors; you can comment and/or add lines without needing to touch neighboring lines. Also, it makes it visually easy to spot missing commas. Give it a try sometime, it’s actually quite nice.