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

Fix for negating a filter script #152

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

evansalter
Copy link

Fixes #151

Added a check for the situation where ! is the operator, and there is no operand. This allows us to use a JSONPath like $[?(!@['pull_request'])] or $[?(!@.pull_request)] where we want to receive the items from an array that don't have a pull_request key.

Open to feedback on this. I know it's not an overly generic fix, but this seems like a pretty specific edge case, so I figured a specific check would be warranted.

@evansalter
Copy link
Author

Test output (no regressions):

❯ rake test
Run options: --seed 58270

# Running tests:

................................................................................................SS.................

Finished tests in 0.343056s, 335.2222 tests/s, 574.2503 assertions/s.

115 tests, 197 assertions, 0 failures, 0 errors, 2 skips
Coverage report generated for MiniTest to /Users/evansalter/dev/jsonpath/coverage. 352 / 361 LOC (97.51%) covered.

@Parth-Rewind
Copy link

@joshbuddy Could you please review it?

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

Successfully merging this pull request may close these issues.

Negating the filter expression using ! is not working
2 participants