pcouy@lemmy.pierre-couy.fr to Programming@programming.devEnglish · 7 days agoThe yaml document from hellruudvanasseldonk.comexternal-linkmessage-square40fedilinkarrow-up1102arrow-down15file-text
arrow-up197arrow-down1external-linkThe yaml document from hellruudvanasseldonk.compcouy@lemmy.pierre-couy.fr to Programming@programming.devEnglish · 7 days agomessage-square40fedilinkfile-text
A 10 minute read covering some YAML edge-cases that you should have in mind when writing complex YAML files
minus-squareEphera@lemmy.mllinkfedilinkEnglisharrow-up28·7 days agoMan, even knowing that YAML document was going to be laden with bullshit, I only spotted the unquoted version strings looking fishy. I also really dislike how often YAML is abused to take keys as list items. Something like this, for example: hosts: debian-vm: user: root database-server: user: sql “debian-vm” and “database-server” are the hostname, and as such they are values. So, this should be written as: hosts: - name: debian-vm user: root - name: database-server user: sql And I’m not just nitpicking here. If we change the example a bit: hosts: database: user: sql …then suddenly, you don’t know, if “database” is just one of many possible hosts or if all hosts always have a shared database with this technology.
minus-squaresik0fewl@lemmy.calinkfedilinkarrow-up9·6 days agoRecently introduced myself to OpenAPI/Swagger and it’s chock full of this. It’s painful.
minus-squarezero_spelled_with_an_ecks@programming.devlinkfedilinkarrow-up5·6 days agoI inherited ansible that always used maps instead of lists and it drove me up the wall. Still untangling that.
Man, even knowing that YAML document was going to be laden with bullshit, I only spotted the unquoted version strings looking fishy.
I also really dislike how often YAML is abused to take keys as list items. Something like this, for example:
hosts: debian-vm: user: root database-server: user: sql
“debian-vm” and “database-server” are the hostname, and as such they are values. So, this should be written as:
hosts: - name: debian-vm user: root - name: database-server user: sql
And I’m not just nitpicking here. If we change the example a bit:
hosts: database: user: sql
…then suddenly, you don’t know, if “database” is just one of many possible hosts or if all hosts always have a shared database with this technology.
Recently introduced myself to OpenAPI/Swagger and it’s chock full of this. It’s painful.
I inherited ansible that always used maps instead of lists and it drove me up the wall. Still untangling that.