kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.62k stars 84 forks source link

Key "on" mistakenly parsed #78

Closed evertonfraga closed 4 years ago

evertonfraga commented 4 years ago

Hi, kudos for the project. It is really useful to me.

However, i just bumped into an issue. while converting a specific key. on: gets translated to true.

Environment

Reproducible steps, using yq own test files:

curl https://raw.githubusercontent.com/kislyuk/yq/master/.github/workflows/pythonpackage.yml | yq .

Output:

{
  "name": "Python package",
  "true": [  <====== HERE
    "push"
  ],
  "jobs": {
    "build": {
…
(the rest of the output is OK)
kislyuk commented 4 years ago

This is not a problem with yq, but with the YAML parser that it uses. PyYAML does not support YAML 1.2, which eliminated the broken behavior that you point out. Feel free to upvote the issue at https://github.com/yaml/pyyaml/issues/116.

evertonfraga commented 4 years ago

Much appreciated. I was now generating a test case for yq, but that won't be necessary.

upvoted.

evertonfraga commented 4 years ago

I found an obvious workaround and I'm just posting here for documentation sake. It works when I changed on: to "on":, in the yaml file.

That works for me now, feel free to close the issue.