yaml.js
yaml.js copied to clipboard
Barfs on multiple lines
this yml
options:
- list: foo
url: bar
tasks:
- Task: 5559
Title: New task
Description: |
Added comment....
Multiple lines
TaskStatusValue: Not Started
parses on http://yaml-online-parser.appspot.com/
but crashes out using yamljs with the error
TypeError: vaule.indexOf is not a function
Possibly related issues I'm seeing:
- if you have a completely blank newline underneath a multiline string then it throws a parse error, if you add at least one whitespace char it no longer fails to parse. This fails:
test: |
example
with a blank newline above
This will parse:
test: |
example
with a newline with whitespace above
- If you have a multiline string without one of the multiline indicators it fails to parse but its valid YAML. This explains all the multiline options in pretty good detail http://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines
myarray:
- example multiline
FAILS
Why is this closed?
Thanks for the details.
This issue is definitely not closed and will be reviewed as soon as I get a moment for that!
I'm having the same issue with parsing multi line strings using v0.2.8 using two different examples.
For https://storage.googleapis.com/kubernetes-charts/index.yaml (attached also) It fails on lines 462-463
description: A Spartakus Helm chart for Kubernetes. Spartakus aims to collect information about Kubernetes clusters.
That file is generated by a YAML parser/linter written in GO (used by Kubernetes). There is a newline and then two more spaces than the "description" indent in that second line. The same happens when users have multilines split by using "" (see fabric8 file sample)
The error is: message: 'Unable to parse.', parsedLine: 463, snippet: ' information about Kubernetes clusters.'
Any updates on this issue? Experiencing it as well.
Same issue, still in 2022.
Happens with the | format, as originally reported, as well as something like:
description:
A description of the error, primarily for internal use. Only error codes should be used
(which must be specific and localized for the frontend).
Hi, I don’t actively work on yaml.js as explained in the README, but pull requests are welcome, still in 2022.