Today on no one should ever use yaml for anything:
15 comments
@druskus of course everything except the simplest solution (quotes) requires having an actually featureful (and hopefully compliant) YAML parser @anselmschueler @anselmschueler @druskus GitHub actions don't support yaml anchors so I wouldn't call it "featureful" @druskus Today in no one should JSON for anything. Seriously, it'd do the *exact* same thing. @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 @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. @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... 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 😖 |
@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