DEV Community

Discussion on: Stop Using YAML

Collapse
 
jessekphillips profile image
Jesse Phillips

If you're ever concerned about ambiguity, just always use quotes.

But that is exactly what I hate. Now I must arbitrarily give advice to always quote or learn the many ways yaml will bite you.

Lists can either be indented, or reside at the same level as their parent.

People use "$ref" : by convention in json in order to use references.

I did not make an alternate recommendation because their are so many out there. Yes having to learn 20 configuration languages over yaml probably isn't worth it

You mentioned machine readable (preserving comments). I don't see this usage. In fact I don't think I've seen it where the machine writes yaml, only humans.

Collapse
 
jeffhykin profile image
Jeff Hykin

But that is exactly what I hate.

Do you hate this about PowerShell and Bash as well?

I don't think I've seen it where the machine writes yaml

That's because it doesn't work well. References are processed on load/import and that breaks the export, comments are destroyed, the style (quoted or unquoted) is ignored, etc. PyYaml is the only one with debatable support for comment preservation and it has plenty of problems. This is one of the weaknesses of YAML, and why it is a problematic replacement for many setup config files like the package.json.

Thanks for the clarifications, they make sense now.

However, I'm now confused why you would title this "Stop Using YAML" if you still think YAML is better than learning 20 different configuration languages.

Thread Thread
 
jessekphillips profile image
Jesse Phillips

Yaml advertising itself as human friendly, then having the same complexity as bash... Bash and powershell don't do that.

It is interesting that you list problems with yaml others are saying it does well... Hmmm...

Thread Thread
 
jeffhykin profile image
Jeff Hykin

Maybe another comment has mentioned this, but you might like StrictYAML. It is a subset of YAML designed specifically to weed out all ambiguity. It might even be the solution you want to suggest as an alternative to YAML.

I can understand where you're coming from with Bash and PowerShell. Learning by mistakes was painful and very confusing in Bash, and I honestly think shell languages need a complete redesign. Funny enough is I actually made an experimental shell to address this by having it accept all arguments in the form of YAML to reduce ambiguity.

I love YAML, but I don't want to pretend that it doesn't have serious flaws. Which is why I mention the problems that it has. I really want it to completely replace JSON, but it is going to need improvements before that is realistic.

For me personally, if it is humans writing YAML with syntax highlighting enabled, I think YAML is the gold standard for config files.

Thread Thread
 
realquadrant profile image
timfong888

Hi i am working on the StackStorm open source project to automate some dev opsy things and the workflows are built in YAML. It is himan readable but brittle. But have been wondering if its the best way to define workflows which may be more dynamic and can be better expressed differnetly, such as ith bitwise operators.

So am interested in alternatives without throwing out the baby wih the bathwater. So curious about strictYAML.

But since a workflow ideally has programmability and graph attributes, what other alts are there?

Thread Thread
 
jessekphillips profile image
Jesse Phillips

I don't have vast experience with different alternatives. I think one of the big challenges often faced is you want something readily available in multiple languages.

I really like Lua. Not as a programming language, but the lightweight embedded part. They keeped the syntax light, but don't go overboard like yaml.