Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property assigment not working in some cases #1631

Open
dayyeung opened this issue Apr 6, 2023 · 2 comments
Open

Property assigment not working in some cases #1631

dayyeung opened this issue Apr 6, 2023 · 2 comments
Labels

Comments

@dayyeung
Copy link

dayyeung commented Apr 6, 2023

Describe the bug

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

case 1

$ yq -n '{"a": 1} + {} | .b = 2'
a: 1

jq equivalent:

$ jq -n '{"a": 1} + {} | .b = 2'
{
  "a": 1,
  "b": 2
}

case 2

$ yq -n '{"a": 1} + ({} | .b = 2)'
a: 1

jq equivalent:

$ jq -n '{"a": 1} + ({} | .b = 2)'
{
  "a": 1,
  "b": 2
}

case 3

$ yq -n '.a = ({} | .b = 2)'
a: {}

jq equivalent:

$ jq -n '.a = ({} | .b = 2)'
{
  "a": {
    "b": 2
  }
}
@mikefarah
Copy link
Owner

Yeah that's def not right - will look into it.

@mikefarah
Copy link
Owner

Fixed the first case in 4.33.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants