KEY_OVER_1024_CHARS error with large indented blocks of comments
Describe the bug If there's a large block of comments hanging indented under a key, that can trigger an error suggesting that the next key indicator is too far away.
To Reproduce
const comment = `# Test comment
owners:
# Test comment
business:
- email: [email protected]
name: Moogly
- distributionList: [email protected]
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
stage: one
`;
console.log(yaml.parse(comment));
The script produces the error:
YAMLParseError: The : indicator must be at most 1024 chars after the start of an implicit block mapping key at line 22, column 1:
# large block of text, large block of text, large block of text, large block of…
stage: one
^^^^^
Removing the indent from the first block of comments works around the error.
Expected behaviour The text is valid YAML, it should be parsed, no matter how many comments there are or whether they're indented.
Versions (please complete the following information):
- Environment: Node.js 16.15.1
-
yaml: 2.1.1
There was a bug in updating the offset during composition for empty mapping values with trailing comments. Thank you for reporting this!
Fixed version released as v2.1.2.
Might check it against my sample again. I don't think the main bug has been fixed yet.
Bother; you're right. I'd found first a minimal example that appeared to trigger the same error, and solved against that only.
New fix released as 2.1.3.
@fluggo Please let me know if that actually fixes this?
Closing as presumably fixed.