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

Unexpected output when looping over empty objects #1613

Closed
planeiii-te opened this issue Mar 22, 2023 · 3 comments
Closed

Unexpected output when looping over empty objects #1613

planeiii-te opened this issue Mar 22, 2023 · 3 comments
Labels

Comments

@planeiii-te
Copy link

planeiii-te commented Mar 22, 2023

Describe the bug
Looping over an empty object still returns a list of elements somehow.

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

Input Yaml
meh.yml:

other: thing
labels: {}

Command
The command you ran:

yq '.labels[] | select(tag != "!!str") | ">" + key + "< " + (key | line) + " " + tag' meh.yaml

Actual behavior

Consistently outputs 0 as the line number. The key is the empty string. This doesn't change even when labels is much lower down in the file.

>< 0 !!null

Expected behavior

# no output
@planeiii-te
Copy link
Author

@mikefarah Bump.

Any ideas about this one?

@mikefarah
Copy link
Owner

Sorry - dropped off my brain. Yep that's a bug, fill fix next release

@mikefarah
Copy link
Owner

Fixed 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