14 ms·
No YAML
- bussierem 5y ago> if SQL were built on YAML Actually that's pretty nice compared to what we actually got: https://schemahero.io/learn/tutorial/create-table/ https://schemahero.io/learn/tutorial/create-table/
- inshadows 5y agoThat airport example... not sure if trolling.
- luismedel 5y agoI find hilarious that they end writing what looks like an AST. In YAML. By hand.
- meepmorp 5y agoAm I alone in thinking SQL by itself is easier to understand and use than all indirection people like to stick on top of it?
- stack_framer 5y agoYou are not alone. I prefer handwritten SQL over abstractions like ORMs.
- notriddle 5y agoFor cases where the query is truly static, I prefer to just write SQL. Building SQL queries by concatenations strings, however, should get you arrested for negligence. If you need a query builder, then you need a query builder.
- ironmagma 5y agoSometimes you need a query builder but one is not available. Heck, last I checked, BigQuery didn’t even do string quoting for you.
- LaserToy 5y agoGiven it is hard to understand SQL once jt reaches 100-200 lines, anything that bloats it just pure evil :)
- sellyme 5y agoAs I continue exploring that site I'm becoming increasingly concerned that it might not be satire.
- Zababa 5y agoIt's at least a great way to present it, way better than the single line string I usually see
- csours 5y agoSounds like we need a YAML: The Good Parts talk See also https://www.youtube.com/watch?v=hQVTIJBZook https://www.youtube.com/watch?v=hQVTIJBZook
- bmn__ 5y agohttps://hitchdev.com/strictyaml/ https://hitchdev.com/strictyaml/
- LaserToy 5y agoWriting Argo workflows in yaml is a special kind of hell.
- mixmastamyk 5y agoI recommend this instead of complicated standard yaml: https://hitchdev.com/strictyaml/ https://hitchdev.com/strictyaml/
- letmeinhere 5y agoNo flow style would be kind of painful at times. I like JSON5, because it has the two extra things I need beyond json: comments and trailing commas.
- bschwindHN 5y agoAfter evaluating several config file formats, I settled on JSON5 for work projects. Only issue for me is that sublime text doesn't have highlighting for it, though the hjson highlighting from package control works well enough. I should write one for JSON5... Ironically the file format for sublime highlighting plugins is in YAML. https://github.com/hjson/sublime-hjson/blob/master/Hjson.sublime-syntax https://github.com/hjson/sublime-hjson/blob/master/Hjson.sub...
- viraptor 5y agoIt's telling that with all those complaints, the website does not list any clearly better alternatives. (before someone says TOML: https://hitchdev.com/strictyaml/why-not/toml/ https://hitchdev.com/strictyaml/why-not/toml/)
- inshadows 5y agoI don't think the point is another configuration language, much as it is to use real programming languages where appropriate. By using TOML you'd make the tasks where YAML is used even more cumbersome to write...
- notriddle 5y agoTOML:YAML :: SVN:CVS If I have to choose one, I’d choose the first one. It really does fix most of the warts. But there’s probably a fundamentally better approach somewhere out there if you can find it.
- soraminazuki 5y agoIt does, see L136-143.
- viraptor 5y agoYes, it lists alternatives, but none of them is "see, use this, it's better". They all have different tradeoffs, otherwise there wouldn't be that many :)
- johnsolo1701 5y agoI just use JSON and related tooling instead. Because YAML is a superset of JSON, all yaml parsers also parse JSON.
- rp1 5y agoIf JSON supported comments it would be perfect.
- justahuman1 5y agoNot exactly plain json, but close: https://json5.org/ https://json5.org/
- zeroimpl 5y agoFrom my experience, if you give pretty-printed JSON to a YAML parser, it will explode.
- cryptica 5y agoIt's so strange that they did this because YAML looks nothing like JSON. The entire point of a standard is to impose constraints to ensure that different people will do things in the same way... That's how you achieve compatibility between different systems. When you have a flexible standard which allows people to do something in many different ways, it defeats the entire point of there being a standard...
- chipotle_coyote 5y agoBurn it all down and go back to INI files! (Kidding.) (Mostly.)
- krapp 5y agoSeriously, I still use INI files when I think they're adequate, and the Godot game engine's default data format is basically INI. I think the general rule here is to use the simplest format necessary.
- edgyquant 5y agoNot that you should but one of the benefits of ini is you can roll your own parser in an hour or so.
- dang 5y agoOne past thread and a bit: No: Body: Wants: To: Write: – YAML - https://news.ycombinator.com/item?id=17360088 https://news.ycombinator.com/item?id=17360088 - June 2018 (71 comments) Nobody Wants to Write YAML - https://news.ycombinator.com/item?id=24638883 https://news.ycombinator.com/item?id=24638883 - Sept 2020 (1 comment)
- johnisgood 5y agoSo what should one use for configuration? I am not going to use JSON because of lack of comments. A configuration file needs comments. TOML does the job for this well, I think.
- eyelidlessness 5y agoTOML is fine. If you use JSON, almost everything has affordances for comments as keys (“//“: …) many also accommodate values ([“//…”]).
- krapp 5y agoLua is also good.
- emptyparadise 5y agoSandboxed Lua with a quick timeout would be great.
- zkldi 5y agoI've taken a massive liking to JSON5[1] recently for configs, but I've never really seen anyone else using it. Sucks, because I think it's really easy to read and write. [1] https://json5.org/ https://json5.org/
- mataug 5y agoA respected senior engineer once told me "all configuration is code, if it modifies the behaviour of software, it needs to be testable" Yaml is huge unintuitive PITA, I recently spent multiple hours figuring out the best way pass CLI arguments to a k8s cronjob via yaml. I only managed to solve the weird error messages after I stumbled upon the stackoverflow post linked in the webpage https://stackoverflow.com/a/21699210 https://stackoverflow.com/a/21699210 > There are NINE (or 63*, depending how you count) different ways to write multi-line strings in YAML.
- eyelidlessness 5y agoI agree that YAML is code and I find it absolutely preposterous that there’s any notion otherwise.
- monsieurbanana 5y agoIs json code, too? Yaml, or json, can be used to describe programming instructions, in which case I could see maybe calling it code. In an informal setting. If you are, for example, writing documentation, please refrain from doing so. But that's entirely situational. A yaml snippet containing my list of groceries is not code. Yaml doesn't have to be classified as code to be testable. "We should have tests for our configuration files" is perfectly reasonable.
- eyelidlessness 5y ago> Is json code, too? I’m amazed this is even a question. Of course it is! It’s explicitly defined as an interchange format. Its only purpose is as code. > In an informal setting. What formal settings are we supposed to be satisfying? > If you are, for example, writing documentation, please refrain from doing so. I respectfully decline this request. > But that's entirely situational. A yaml snippet containing my list of groceries is not code. > Yaml doesn't have to be classified as code to be testable. "We should have tests for our configuration files" is perfectly reasonable. I mean this with kindness and sincerity, if a little incredulity: maybe your definition of code is ambiguous and warrants some clarification. To me, this isn’t a holistic definition but it certainly seems like a relevant starting point: if it has a syntax specification that machines can use, it’s code.
- paxys 5y agoIMO "configuration languages are bad" and "YAML is bad" are two very different discussions. Mixing them up takes away from both. Most of the complaints against YAML are really complaints against complex systems (Kubernetes, CI pipelines) which use it as their interface. The rest of the problems can be solved by quoting your strings. YAML works perfectly well if it is (1) used for the right use cases rather than as a substitute for code and (2) paired with a linter or parser which handles its quirks.
- deleted 5y ago[deleted]
- smt88 5y ago> The rest of the problems can be solved by quoting your strings. How do I get all of YAML's millions of other users to quote all of their strings? What about programmatically generated YAML? Also, you're entirely ignoring two other major issues: meaningful whitespace (making YAML hard to read and write) and multiple ways of doing the same thing (making it confusing).
- Spivak 5y agoThe best practical advice I can offer: - For your own projects use yamllint, put it in your CI pipeline, and your pre-commit hooks. You can forbid the use of flow sequences like [ and {, require quotes, and forbid truthy values for bools. - USE JSON-SCHEMA. It works on YAML. - For programmatically generated YAML just generate JSON and call it day. - If you have a tool that for some reason requires YAML but not JSON then don't write YAML. Write your config in $programming_language and only dump the YAML at the end. Troposphere is a Python library for CloudFormation JSON that embraces this idea. - Don't template YAML files (or JSON for that matter). Again just use variables in your programming language of choice and then dump. Helm is an abomination and the authors should be ashamed of themselves. Ansible had the common sense to only allow templates in the values instead of at the file level.
- smt88 5y agoWe pretty much just use JSON exclusively, since JSON is also valid YAML (another bizarre design decision in YAML, but a blessed escape hatch for me). That is, I suppose, a strike against YAML: we just "downgrade" to JSON and never have any issues.
- munificent 5y agoI strongly believe that if Crockford hadn't refused to add comments to JSON that YAML, TOML, and other generally bad configuration languages wouldn't exist.
- jhanschoo 5y agoJson is a fragment of yaml, which means that all valid json documents are valid yaml documents. Yaml has parts that broaden its use cases, but I'm slightly surprised that json+yaml comments isn't a more widespread thing.
- deleted 5y ago[deleted]
- XorNot 5y agoYAML works better with line-oriented diff'ing systems - i.e. git (though you need to massage it a lot to make it sensible).
- hollasch 5y agoHe didn't "refuse to add" them. JSON had comments, and then he removed them.
- thatswrong0 5y agoPardon my French but.. wat
- schwede 5y agoMy interpretation is that since json is JavaScript Object Notation, JS objects can clearly have comments so why limit their usage in json?
- rossy 5y agoThere are other things that make JSON a bad configuration language with poor human readability and writability. Lack of multi-line strings is a big one. The requirement to put a comma after every array item and object member except the last has made me write more syntax errors in JSON than I've ever written in YAML. Also, JSON is unsuitable for config files with lots of Windows-format paths, since backslash is its escape character.
- enricozb 5y agoHas anyone had a look at this: https://kdl.dev/ https://kdl.dev/? It's been on my to-check-out list for a while now.
- rgoulter 5y agoThis makes me wish there were a translation of https://www.mcmillen.dev/language_checklist.html https://www.mcmillen.dev/language_checklist.html for configuration/markup/document languages. :)
- theonemind 5y agoDevelopers seem to complain about anything that takes a little bit of memory and care. To a limited extent, that's not a bad thing--our brains have limits. However, when the benefits outweigh the costs, complaining about it is a bad thing. Regular expressions are a good example. Developers seem to hate them. I find them easy and intuitive, and I'm not the sharpest tool in the shed. However, I will take some care to commit some stuff to memory and make some notes. That's it. When you know what characters are magic, know what the special characters mean, they're extremely straight-forward except when they're very complex. Same thing with YAML. It's got a couple of rough edges, but the complexity carries its weight, and most of the difficulties go away if you bite the bullet and memorize it. Just commit those block chomping operators to memory, it doesn't hurt that much, then you can get on with your life and quit complaining about YAML and make it work for you.
- selcuka 5y agoWriting it is not the only problem though, you should also be able to read it. What if the person who wrote it was not using your conventions? There are numerous, subtly different ways to accomplish the same end result in YAML.
- drewcoo 5y agoDevelopers should complain even more about anything that causes extra cognitive load. It's one of the greatest threats to our productivity.
- skywhopper 5y agoI find YAML, for all its flaws, to strike a lot better balance between usability and clarity than the alternatives. But whatever, people have their own preferences. Ultimately, I don’t think it would be possible to avoid the sorts of problems people run into in any configuration language unless you have a strict type system on the config itself. But strict type systems on config have been tried and end up causing their own distinctive problems. In the end people will complain about whatever their interface is to a complex system. They will always make errors in configuration and that will always be annoying.
- kbd 5y agoHas anyone taken a look at Cue who can share any experiences? https://cuelang.org/ https://cuelang.org/ It's mentioned on the site as an alternative to Yaml. Recently watched (~half of) this intro to it: https://youtu.be/fR_yApIf6jU https://youtu.be/fR_yApIf6jU
- lytedev 5y agoBeen using it for the docker compose that builds my entire homelab (~30 services, fairly complex config) and I love it. It's saved me from some really nasty bugs a handful of times.
- harpratap 5y agoI think it has the right take on configuration vs code but being a new language it's lacking a lot of basic things like package management, lot's of bugs and in my case - scaling issues.
- jmort 5y agoThe points in this post reminds me of the “configuration clock”[1]. Hardcoded -> configure file -> rules -> DSL -> Hardcoded. Maybe it should be the “configuration ouroboros”. Provides one explanation for why this config becoming code situation occurs over and over and what to watch out for. [1] http://mikehadlow.blogspot.com/2012/05/configuration-complexity-clock.html http://mikehadlow.blogspot.com/2012/05/configuration-complex...
- infogulch 5y agoThis came up in a recent podcast. They thought that the plain clock model doesn't account for real progress being made, and that a better model is the "configuration spiral": it looks like the clock when viewed from above but shifting your perspective a bit reveals that it's actually a spiral that describes how to build abstraction layers. Not that we hit the mark every time, but that a clock is too reductionist.
- physicles 5y agoPrecisely. In a case at work, I’ve found that some YAML is complicated because the abstraction level at which it’s describing things is too low; the fix is to move a most of the logic into code and keep some minimal flexibility in the YAML (or use SQL instead, though that choice is more about who we want to empower to edit it).
- Zababa 5y agoThere's also the "Heptagon of configuration" https://matt-rickard.com/heptagon-of-configuration/ https://matt-rickard.com/heptagon-of-configuration/
- gregwebs 5y agoThe best setup I ever had going was cuelang (strongly-typed, JSON-like) compiling down to JSON or YAML as needed. Using strongly typed programming languages (like how Pulumi uses TypeScript) also works well.
- marcinzm 5y agoI just find all of this amusing in the world of big data: - First there were bash scripts kicked off by cron - Then there was Oozie which was XML and not those messy scripts - Then there was Airflow which was code and not that messy XML - Now there is Argo/etc. which are Yaml and not that messy code The endless cycle of code-to-config-to-code continues.
- poopinions 5y agoJesus fucking Christ. Every single year we have people in giant companies continue to completely misunderstand simple concepts, and YAML is probably the most egregious. First of all. YAML is supposed to be human readable, not writeable. If you even learn the standard, you realize that it's primarily a multi-document streaming data format. That means it's intended to be written on the fly by a machine. The macros it contains are rudimentary and don't actually recursively interpolate data. The extensions are designed solely for external applications to evaluate, leaving the humans out of the loop. And its many different object types are intended for the serialization of program data structures - not for a human to write the word NO in their terminal text editor, into the data format designed for a program to deserialize arbitrary data. Stop fucking writing shit in YAML by hand! And while we're on the subject, please, for dick's sake, stop treating data formats like configuration formats!! An Apache or Nginx config file is a configuration format. YAML is a data serialization format that is human readable. Learn the difference.
- cwiggs 5y agoHow should one create kubernetes infrastructure then?
- thrower123 5y agoDon't, mostly.
- jb3689 5y agoI didn't think YAML was that bad until I heard about unexpectedly truncated YAML files still producing valid YAML
- rdw 5y agoYAML's not bad if you couple it with strong types. I used YAML _heavily_ and wasn't aware of any of the issues that the author mentioned because of the types. It doesn't let YAML automatically parse dates because the destination structure is either a date or a string or whatever, and that controls the parsing. It doesn't have the Norway problem because it knows whether a field is a boolean or not. I don't think it had the octal problem, not 100% sure though. It's very good for non-technical people to edit because they are allergic to symbols and quotes and brackets and making sure things match. YAML's syntax let you write like you're a CEO sending agenda notes to a subordinate. You can easily switch between line-per-item and brackets-style and you do so whenever the readability is improved by doing so. It's highly intuitive somehow. You can pretty much turn someone into a config-editor just by showing them an example file, especially with syntax highlighting.
- zeroimpl 5y agoSounds like you are using a specialized parser. At that point, it’s not YAML.
- rdw 5y agoIt used an off-the-shelf library, I don't remember which one anymore. I don't think it really matters though -- YAML is a format, not a parser. Per the YAML docs [0], "Creating a fully compliant parser has proven almost impossible." Pretty much every YAML parser out there is going to have its own idiosyncratic subset that it handles. That doesn't make the _files_ not-YAML. (This does make YAML a horrible data exchange format. No argument there!) Also, JSON has a similar condition [1]. [0]: https://github.com/yaml/yaml-grammar https://github.com/yaml/yaml-grammar [1]: http://seriot.ch/projects/parsing_json.html http://seriot.ch/projects/parsing_json.html
- UI_at_80x24 5y ago>It's very good for non-technical people to edit I strongly disagree. Being whitespace sensitive it's stupidly bad for non-technical people. I don't like YAML for several reasons, to be honest I'd prefer an .ini based config setup or BSD styled "option=variable" config file paradigm. But I hate/despise/loathe the fact that YAML files are whitespace sensitive. That's a horrible choice. I hate python for it too, and avoid it's use whenever possible.
- mastax 5y agoI don't hate yaml. It's a bit overcomplicated, a bit too cute, but it works. It doesn't leave a lot of room for additional complexity, though. I've been using Ansible a lot recently. I like it a lot, most of the time. Its configuration files are YAML + Jinja2 templates + Python expressions. It works fine for the basics but when you push it quickly devolves into madness. e.g. I had a task like this: - set_fact: foo_bar: > {{ item | map(attribute="something") | rejectattr("bar", "none") | flatten | select is any }} Can you spot the error? The block scalar header `>` was missing the hyphen `>-`. YAML helpfully added a newline to the end of the template output. Python helpfully interpreted "False\n" as `true`. I'm starting to think I should write Python modules for anything complex.
- XorNot 5y agoThis is exactly why I love Ansible. It has libraries to handle most of what I need, and most of what I need to do is just simple YAML expressions. When it gets complex though, it's first-class supported to drop into Python (or anything else which works as an executable script language) to get more control.
- cyber_kinetist 5y agoUnity uses a subset of YAML as its serialization format, and dear god that is one of the worst choices they’ve made. Very hard to decipher, very hard to resolve merge conflicts, and god awful slow. YAML is good as a concise configuration description language, but using it as a serialization format for general data should be avoided at all costs.
- pmarreck 5y agoWould it be possible for someone to come up with an "unofficial strict YAML" that gets away from a lot of the unfortunate complexity?
- Noe2097 5y agoTaking a step back; this website is a piece of Art. Its message stirs passions, it is written in the very formalism it talks about, and presented in a so unusually cumbersome way that it triggers the same kind of response (or questions) a surrealist setup do (essentially boiling down to: "why the f...?"). Thank you, it was delightful to experience.
- ghuntley 5y agoThank you for understanding the essence! :D
- edave64 5y agoI got introduced to YAML back when I first got into Ruby on Rails. At first it seemed really cool, nice to read and write Then I tried to use it in one of my own projects and immediatly ran into issues. Mostly that it was difficult to judge what data structures you would get. Massively different syntax could result in the exact same structre, slight changes could make it something completely different. I just really didn't like it :/
- mbar84 5y agoI have been using cuelang.org now for half a year and have nothing but praise to give.
- nanoscopic 5y agoYAML is garbage. Everyone knows. If you have a choice of anything else, use any of the many extended JSON versions. Everyone says the same stuff every time this comes up. None of the discussion usually matters as you are forced to use YAML whenever the thing you are using chooses to only accept YAML.
- utf_8x 5y agoYeah, YAML is pretty bad but... Is there really a better alternative? JSON is a horrible format for configuration, KDL is a cute idea in theory but in practice it makes me want to gouge my own eyes out, CUE is... weird, XML and INI should've been dead for years and TOML is just INI on meth... At least JSON and YAML are somewhat interoperable (JSON is valid YAML* and converting YAML to JSON is trivial) and have native support in most modern languages... * with some caveats