Email or username:

Password:

Forgot your password?
drusk

Today on no one should ever use yaml for anything:

15 comments
Anselm Schüler

@druskus this is just misuse of YAML.
if you want to do something like this, you can:
- use a quoted scalar. in JSON "1.70" w/o quotes is also 1.7
- use an explicit tag. if using the JSON or core schema you can write !!str 1.70
- use the failsafe schema. this interprets everything as strings always. since this looks like bash it wouldn't even matter
- use a custom schema that always parses specifically the version field as a version identifier

Anselm Schüler

@druskus of course everything except the simplest solution (quotes) requires having an actually featureful (and hopefully compliant) YAML parser

drusk

@anselmschueler
For sure, obviously this is is a misuse of YAML. The problem is that these mistakes are silent, and they keep happening over and over.
This is a big design flaw in YAML in my opinion.

zarel

@anselmschueler @druskus GitHub actions don't support yaml anchors so I wouldn't call it "featureful"

Lawrence Pritchard Waterhouse

@druskus Today in no one should JSON for anything. Seriously, it'd do the *exact* same thing.

drusk

@lpwaterhouse Sure, correct me if I'm wrong, but JSON seems to have fewer of these gotcha moments.

It feels like YAML always tries to assume what your thing is supposed to be, instead of forcing you to do things.

The actual way would probably be some other alternative like dhall

Lawrence Pritchard Waterhouse

@druskus Not by much, many YAML *parsers* are crap, but the spec itself is actually designed to be a superset of JSON and doesn't *add* many cases. One example would be that it does the usual unix bullshit of treating 0123 as an octal number... I'm no fan of YAML, but in itself it really doesn't deserve the hate.

Lawrence Pritchard Waterhouse

@druskus And many of the things it adds would actually allow you to be far more strict, "Tags" are actually a way to express data-types concisely in-band, with JSON you *need* external schemas for that. Problem is: YAML is so simple that people don't read the spec and thus don't use these features...

drusk

@lpwaterhouse Fair points. Also someone had the great idea of templating yaml.

drusk

@Aedius imagine if 1.7 was a valid tool chain

Aedius Filmania ⚙️🎮🖊️

@druskus

Unfortunately, I don't have to imagine ...

I got the issue with version 2.10 of one application that was buggy ... Because kubernetes depoyed the release 2.1 😖

Daniel

@druskus the moment I opened the yaml spec pdf and learned what monstrosity it is, the moment I never wanted to use yaml ever again

Go Up