-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-line arrays in square brackets cause YAMLSemanticError #113
Comments
1
I went through the spec yet again, and it's not completely clear that something like this is in fact valid YAML: foo: {
bar: baz
} The test suite does include a test that makes it clear that this would be wrong: foo: {
bar: baz
} ... while this is completely fine: {
bar: baz
} Tracing through the relevant constructions would indicate that even the terminal But that's a bit dumb, and as you figured most other libraries don't actually require that -- or maybe I just made a mistake when reading the spec. In any case, I've hopefully fixed this now, and will let it parse without error at least until someone complains. |
My issue was about arrays split over multiple-lines (see title) and not maps/dictionaries. # ...
enum: [
"abc",
"cde"
] |
@eemeli Most libraries even don't care about flow collection indentation at all.
tested with the yaml-editor:https://gist.github.com/6686d1623cb6fc09757932bfbe3a61b5 I can understand why this:
looks valid, but not this:
The YAML spec (as I understand it) is very consistent there. The closing But it seems a lot of YAML documentes are out there that use this, so your decision to allow it is probably reasonable. |
@klingtnet Apologies for any confusion; yaml/tests/cst/corner-cases.js Lines 236 to 259 in f8d35f4
|
The library fails to parse multi-line arrays in square brackets. I stumbled upon this issue when speccy used this library for parsing the OpenAPI specification. Following is a minimal example to reproduce the issue:
package.json
:example.yaml
:test.js
:Ruby parses the YAML without problems:
The same goes for
PyYAML
:The text was updated successfully, but these errors were encountered: