luxas / deklarative

A library to work with serialized declarative configuration, e.g. Kubernetes-style YAML in a file
Apache License 2.0
0 stars 0 forks source link

Ensure the "norway problem" doesn't exist in the YAML parser #7

Open luxas opened 3 years ago

luxas commented 3 years ago

The "norway problem" was popularized from blog posts like https://hitchdev.com/strictyaml/why/implicit-typing-removed/

In YAML 1.1 there is an "implicit typing" feature that converts no, yes, YES, NO etc. literals to true or false:

For example, the boolean “true” might also be written as “yes”.

See the attached slides for a practical example of how unintuitive this is

image image

This is luckily fixed in YAML 1.2:

We have removed unique implicit typing rules and have updated these rules to align them with JSON's productions. In this version of YAML, boolean values may be serialized as “true” or “false”; the empty scalar as “null”.

yaml.v2 is supporting YAML 1.1, but yaml.v3 implements YAML 1.2; hence we should use yaml.v3