Repository navigation
Accept a tab after the indentation of a block scalar's first line - #18
reuvenharrison merged 1 commit into
Conversation
When a block scalar's indentation is auto-detected, a first content line
made of the indentation spaces followed by a tab was rejected with
"found a tab character where an indentation space is expected". YAML
1.2.2 counts only spaces as indentation, so the tab is content (example
8.2, yaml-test-suite R4YG, 96NN and Y79Y/001). A tab inside the parent's
indentation is still an error.
Same change as yaml/go-yaml 85bfc37 ("Preserve tab content after block
indentation", merged in yaml/go-yaml#440). go-yaml v4 counts columns
from 1 and parser.indent the same way, so the condition carries over
unchanged.
|
Reviewed and verified independently, CI is green now too.
One thing worth knowing before this gets released: getkin/kin-openapi#1238 replaces the JSON round trip with native YAML decoding and, in doing so, drops So this is worth merging and releasing for the current dependency path, and the durable fix is the same one-line change on the |
|
Thanks for checking this end to end. And you're right.. the two error cases already errored before the change, so they guard the parent-indentation check rather than pin the fix. I've updated the description. Good catch on getkin/kin-openapi#1238. I've opened the backport on the In the meantime it would be great to merge and release this one, so the current dependency path is fixed until kin moves. |
|
Quick update from yaml/go-yaml#453. |
Fixes oasdiff/oasdiff#1356.
When a block scalar's indentation is auto-detected, a first content line made of the indentation spaces followed by a tab is rejected with "found a tab character where an indentation space is expected". YAML 1.2.2 counts only spaces as indentation, so the tab is content (Example 8.2). A tab inside the parent's indentation is still an error.
This is the same change as yaml/go-yaml@85bfc37, merged in yaml/go-yaml#440. go-yaml v4 counts columns from 1 and
parser.indentthe same way, so the condition carries over unchanged.Tests: Example 8.2 and
a: |-\n \ttext\nnow decode, and both fail without the change.a:\n b: |\n \ttext\nand- |\n\ttext\nstill error; they already errored before the change and guard the parent-indentation check.Checked:
go test -race ./...passes.openapi.yamlfiles through kin-openapi: the 1,929 that loaded before are unchanged; 31 that failed with this error now load (Adyen Checkout/Payment/Payout, amadeus.com).Not changed: a top-level block scalar with content at column 0 (
|\n\ttext\n) still errors, now with "found character that cannot start any token". yaml3 requires top-level block scalar content to be indented at least one space; that's separate from this fix.