yq icon indicating copy to clipboard operation
yq copied to clipboard

"YAML" directive 1.2 causes: Error: yaml: found incompatible YAML document

Open Slooz opened this issue 2 years ago • 3 comments

Describe the bug A "YAML" directive causes the following:

Error: yaml: found incompatible YAML document

Version of yq: 4.12.2 Operating system: mac Installed via: homebrew

Input Yaml data1.yml:

%YAML 1.2
---
foo

Command The command you ran:

yq eval '' data1.yml

Actual behavior

Error: yaml: found incompatible YAML document

Expected behavior

foo

Additional context The YAML specification says:

A version 1.2 YAML processor must accept documents with an explicit “%YAML 1.2” directive

Slooz avatar Sep 13 '21 19:09 Slooz

The following causes this issue: https://github.com/go-yaml/yaml/issues/298

Slooz avatar Sep 13 '21 19:09 Slooz

The go-yaml repo has been pretty quite lately :(

mikefarah avatar Sep 15 '21 06:09 mikefarah

I realize that there's not much that can be done about this. Feel free to close this issue.

Slooz avatar Sep 16 '21 14:09 Slooz

Fixed in v4.30 (basically I preprocess files so go-yaml never sees it)

mikefarah avatar Nov 30 '22 22:11 mikefarah