Debian Codegraph @

docs/src/why/flow-style-removed.md

raw
1 ---
2 title: What is wrong with flow-style YAML?
3 ---
4
5 Flow style is essentially JSON embedded in YAML - making use of curly { } and square brackets to denote lists and mappings.
6
7 Example:
8
9 ```yaml
10 a: 1
11 b: {c: 3, d: 4}
12 ```
13
14 This use of JSONesque { and } is also ugly and hampers readability - *especially* when { and } are used for other purposes (e.g. templating) and the human reader/writer of YAML has to give themselves a headache figuring out what *kind* of curly bracket it is.
15
16 The *first* question in the FAQ of pyyaml actually subtly indicates that this feature wasn't a good idea - see "[why does my YAML look wrong?](http://pyyaml.org/wiki/PyYAMLDocumentation#Dictionarieswithoutnestedcollectionsarenotdumpedcorrectly)".
17
18 To take a real life example, use of flow style in [this saltstack YAML definition](https://github.com/saltstack-formulas/mysql-formula/blob/master/mysql/server.sls#L27) which blurs the distinction between flow style and jinja2,
19 confusing the reader.
20
21
22 ## Parsing 'dirty' YAML with flow style
23
24 To parse YAML with flow style, you can use [dirty load](../../using/alpha/restrictions/loading-dirty-yaml).
25
26
27 ## Counterarguments
28
29 - <https://github.com/crdoconnor/strictyaml/issues/20>
30 - <https://github.com/crdoconnor/strictyaml/issues/38>