open-policy-agent/conftest

Conftest fails on YAMLs with version

Opened this issue · 2 comments

I wanted to check a YAML document with the YAML version in the preamble

%YAML 1.1
---
group_id: 1234

... using ...

conftest test --parser yaml test.yml

However, conftest fails stating

Error: running test: parse configurations: parser unmarshal: unmarshal multiple documents: unmarshal subdocument yaml: error converting YAML to JSON: yaml: line 1: did not find expected <document start>, path: test.yml

If I remove the preamble, it works.

This is new to me, but a quick skim of the YAML 1.2 spec indicates this should be supported. Conftest is using sigs.k8s.io/yaml for its YAML parsing. Do you happen to know of any Golang YAML parsers that support this?

Do you happen to know of any Golang YAML parsers that support this?

No, not really.

My fix was so far to simply remove the preamble ...