YamlDotNet
YamlDotNet copied to clipboard
Missing space between colon and value throws exception in case of flow mappings
#TestYaml
test:
/{param}:
type: { collectionsTypes.mutableResource:{}}
The above YAML works fine in all other YAML parsers but not this one. I get the following exception:
(Line: 4, Col: 14, Idx: 42) - (Line: 4, Col: 46, Idx: 74): While scanning a plain scalar, find unexpected ':'.
This exception does not come if there is space between colon and the curly bracket:
type: { collectionsTypes.mutableResource: {}}
However, as per YAML 1.1 specification this is a case of flow mappings (http://www.yaml.org/spec/current.html#id2544175) which uses separation spacing (http://www.yaml.org/spec/current.html#id2521201) i.e. this spacing is optional. It should be ignored during parsing and a missing space should not throw an exception since it is not invalid.
I'm sorry I was unable to answer this question in a timely fashion. As you have certainly moved on to other things, I will close this issue, but feel free to reopen it if necessary.
Hey @aaubry . The issue still exists and yes, I'd like to reopen it. Thanks
This also fails in the reference parser. Therefore, I'm going with it's invalid YAML and that space is supposed to be there seeing as how it passes the reference parser when it's there.
http://ben-kiki.org/ypaste/data/66223/index.html