Implicit Typing in StrictYAML
See original GitHub issueConsider this YAML:
array:
- string 1!
- string: 2?
Which parses into this:
{'array': ['string 1!', {'string': '2?'}]}
The value determines its type. You’ve eliminated this behavior for primitive types:
python: 3.5.3
postgres: 9.3
Both are strings. But there is still implicit typing between string and map.
An array element syntax like:
array:
-
key1: value1
key2: value2
-
key1: value1
key2: value2
- some: text
would fix this behavior but then it wouldn’t be a subset of YAML anymore 😄
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
why StrictYAML refuses to do implicit typing and so should you
The real fix requires explicitly disregarding the spec - which is why most YAML parsers have it. StrictYAML sidesteps this problem by ignoring...
Read more >crdoconnor/strictyaml: Type-safe YAML parser and validator.
StrictYAML is a type-safe YAML parser that parses and validates a restricted subset of the YAML specification. Priorities: Beautiful API; Refusing to parse...
Read more >why StrictYAML refuses to do implicit typing and so should you
The problem is that people try to parse yaml without such schemas, both because that's doable with other languages (eg json) and because...
Read more >strictyaml 0.1 - PyPI
StrictYAML is a YAML parser that forces you to explicitly type your YAML with a schema before parsing it, eliminating parse surprise bugs...
Read more >What's Wrong with StrictYAML - Sand Fox
Implicit Typing. x: yes y: null. Example pyyaml/ruamel/poyo: load(yaml) == {"x": True, "y": None}. Example StrictYAML without schema:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we’re going around in circles now.
So we have a parser error determined by the content of a value:
key: key: value
vskey: key:value
Implicit Typing determined by the content of a value in valid YAML:which will lead to errors in unvalidated programs. Validation error determined by the content of a value:
load(yaml_string, Map({"array": Seq(Str())}))
What about the goals stated in the FAQ?