You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following yaml is invalid according to the spec:
args:
- | aaa key: nest1: something nest2: nest2a: b
This is because when the Block Indentation Indicator is absent, content indentation level is determined by the leading spaces in first non-empty line (or largest number of spaces if there are only empty lines).
Section 8.1.1.1. of yaml v1.2.2 spec:
If no indentation indicator is given, then the content indentation level is equal to the number of leading spaces on the first non-empty line of the contents. If there is no non-empty line then the content indentation level is equal to the number of spaces on the longest line.
It is an error if any non-empty line does not begin with a number of spaces greater than or equal to the content indentation level.
go-yaml v1.10.0 does not return an error in this case.
Here is a test that reproduces the issue:
funcTestParseBlockIndent(t*testing.T) {
in:=`args: - | aaa key: nest1: something nest2: nest2a: b`_, err:=parser.ParseBytes([]byte(in), 0)
iferr==nil {
t.Fatalf("expected error, but no error was produced")
}
}
For the record, correct version of the block scalar above should have the indentation indicator present, like this:
args:
- |2 aaa key: nest1: something nest2: nest2a: b
The text was updated successfully, but these errors were encountered:
The following yaml is invalid according to the spec:
This is because when the Block Indentation Indicator is absent, content indentation level is determined by the leading spaces in first non-empty line (or largest number of spaces if there are only empty lines).
Section 8.1.1.1. of yaml v1.2.2 spec:
go-yaml v1.10.0 does not return an error in this case.
Here is a test that reproduces the issue:
For the record, correct version of the block scalar above should have the indentation indicator present, like this:
The text was updated successfully, but these errors were encountered: