cloudbase/powershell-yaml

Powershell-Yaml incorrectly errors on duplicate key

Closed this issue · 2 comments

I have the latest powershell-yaml installed.
When reading https://github.com/DataDog/datadog-agent/blob/main/.gitlab-ci.yml

powershell-yaml throws a duplicate key error.
This file is properly parsed by gitlab, yamllint.com, etc.

Hi @derekwbrown

Try passing in the -UseMergingParser as an argument to ConvertFrom-Yaml

Example:

ConvertFrom-Yaml -UseMergingParser -Ordered (gc -raw ./.gitlab-ci.yml)

Please note, the merging parser does have some limitations as stated here:

https://github.com/cloudbase/powershell-yaml?tab=readme-ov-file#merge-keys-support

But it does seem to work on the yaml from the above link.

That did indeed work. Thanks!