jsonpath icon indicating copy to clipboard operation
jsonpath copied to clipboard

Fix for negating a filter script

Open evansalter opened this issue 2 years ago • 2 comments

Fixes https://github.com/joshbuddy/jsonpath/issues/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 $[?([email protected]_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 avatar Feb 22 '23 15:02 evansalter

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.

evansalter avatar Feb 22 '23 15:02 evansalter

@joshbuddy Could you please review it?

Parth-Rewind avatar Feb 22 '23 16:02 Parth-Rewind