strictyaml icon indicating copy to clipboard operation
strictyaml copied to clipboard

Documents with single scalars or only comments do not parse correctly

Open stuckyb opened this issue 5 years ago • 2 comments

Unless I am missing something, which is certainly possible, I do not think StrictYAML is correctly parsing documents that consist either of only comments or comments with a single scalar. Example document:

# Some comment.
"A string value."

Using ruamel.yaml:

doc = '# Some comment.\n"A string value."'

from ruamel.yaml import YAML
print(YAML().load(doc))

The output is:

A string value.

With StrictYAML:

import strictyaml
print(strictyaml.load(doc))

The output is:

# Some comment.
"A string value."

It appears that StrictYAML is including the comment in the scalar value.

Thanks for the great work on StrictYAML and for any help with this issue.

stuckyb avatar Feb 19 '19 18:02 stuckyb

Yep, that looks like a bug, thanks for reporting.

crdoconnor avatar Feb 20 '19 00:02 crdoconnor

I have the same problem with the current version of strictyaml.

Is this supposedly fixed?

julie777 avatar Mar 05 '22 00:03 julie777