4 ms·
Ever edit a 200 line yaml file? There are worse options than JSON.
by base698 8y ago
Ever edit a 200 line yaml file? There are worse options than JSON.
- raphinou 8y agoI never did, what problems did you encounter?
- mmastrac 8y agoNot the parent commenter, but it really gets tough to figure out _where_ you are in a bunch of nested lists, objects, etc deep down in the yml file. When the schema gets complicated enough you start having to refer back to the documentation to understand what syntax a particular item needs (I'm looking at you, docker compose!) One example from a larger file: networks: macvlan51: driver: macvlan driver_opts: parent: eth0.51 ipam: config: - gateway: 192.168.51.1 subnet: 192.168.51.0/24 Maybe I'm just getting older and dumber, but that hyphen under config seems completely arbitrary to me (and the necessity of it is poorly documented in the manual). This gets magnified to the extreme as your config file grows. Maybe this is a list of objects under a key? Who knows. Edit: OK, it looks like hyphens indicate arrays in the schema but for me it feels like a guess as to which one of these to use for each particular case.
- breck 8y agoWithout the hyphen configs value would be an associative array. With it it’s a list. I’ve been editing long sublime-syntax files recently and I do not like it much. But I’m also not sure if JSON would be better for such a thing.
- jayd16 8y agoWhats the point of a list of tuples? Order? Json seems more immediately obvious and consistent in this case ie [{a:b},...]
- detaro 8y agoIt's not a list of tuples, it's a list of dictionaries.
- jayd16 8y agoAh, but my confusion just deepens my point, haha.
- detaro 8y agoIt's mostly a question of what you're familiar with. JSON using [] and {} to denoting list vs dict isn't fundamentally easier than "-" and a prefix-less list of key:value pairs. YAML has a bunch of extra complexity, but IMHO this difference is really not it.
- afiori 8y agoFrom a syntax standpoint parenthesis are extremely more clear than prefixes+whitespace (maybe less readable).
- smt88 8y agoSemantic whitespace is a nightmare. It's also sometimes I ambiguous whether things are ints, bools, or strings.
- nine_k 8y agoI did, and it was mostly painless, both from IntelliJ and from Emacs. I do know about a number of gotchas, and stepped on some briefly. Yaml is not ideal, but its set of tradeoffs is more suitable for human-editable configs, from my point of view.
- marmaduke 8y agoI’ve had to debug 600+ line elasticsearch queries in JSON format, while working the yaml for Ansible playbooks also quite long. It doesn’t matter the language or syntax, if the unit of structure doesn’t fit on the screen, it’s hard to work with.