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
... // data1.yaml converted to json properly
Error: yaml: line 4: did not find expected key
Expected behavior
Error: data2.yaml: line 7: bad indentation
Additional context
Here the problem is the bad indentation on line 7 with the 4th item in the array, but the reported error is:
Error: yaml: line 4: did not find expected key
Where the item 2 with attr 2 looks just fine, it doesn't even point to item 3, which makes it confusing and not helpful with locating the actual problem.
And the difference between the actual line and the reported line could be quite large when item 3 takes many lines.
Also it should report the file name whenever available, this would be very helpful when processing multiple input files.
Nevertheless, thank you very much for making yq, it's very useful, especially in places where json is too strict and jq refuse to work, that's when yq would come and rescue :-)
The text was updated successfully, but these errors were encountered:
I can't do much about the error message, as that comes from the underlying go-yaml parser. I can however report the filename - that makes a lot of sense too 👍🏼
Describe the bug
When an item in an array is indented wrong, the error message reported is unclear, and it points to the wrong line.
Version of yq:
4.16.1
Operating system: mac
Installed via: homebrew
Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:
data2.yml:
Command
The command you ran:
Actual behavior
Expected behavior
Additional context
Here the problem is the bad indentation on line 7 with the 4th item in the array, but the reported error is:
Where the item
2
with attr2
looks just fine, it doesn't even point to item3
, which makes it confusing and not helpful with locating the actual problem.And the difference between the actual line and the reported line could be quite large when item
3
takes many lines.Also it should report the file name whenever available, this would be very helpful when processing multiple input files.
Nevertheless, thank you very much for making yq, it's very useful, especially in places where json is too strict and jq refuse to work, that's when yq would come and rescue :-)
The text was updated successfully, but these errors were encountered: