strictyaml
strictyaml copied to clipboard
Forbid implicit multiline scalars
list:
- value1
- value2
will be parsed as:
{
"list": [
"value1",
"value2"
]
}
But this:
list:
- value1
- value2
will be parsed as:
{
"list": [
"value1 - value2"
]
}
This is very confusing and error-prone. Maybe multiline scalars should be available only inside a Block Scalar?
Definitely up for this in the hardened spec.
On Sat, 2 May 2020, 07:52 Evgeniy Reizner, [email protected] wrote:
list:
- value1
- value2
will be parsed as:
{ "list": [ "value1", "value2" ] }
But this:
list:
- value1
- value2
will be parsed as:
{ "list": [ "value1 - value2" ] }
This is very confusing and error-prone. Maybe multiline scalars should be available only inside a Block Scalar https://yaml.org/spec/1.2/spec.html#Block?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crdoconnor/strictyaml/issues/100, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOJKNITAF6UBOB6DKETYVDRPO7K7ANCNFSM4MXR5CBA .
I think that
list:
- value1
- value2
should be a parse error. Value1 should be the first element of the list and then fail with an indentation error.
I guess I am saying that restricting multiline scalars to only work in block starting on a new line would be a reasonable restriction. From the zen of Python "There should be one-- and preferably only one --obvious way to do it."
Getting rid of inline formats also agrees with this.