Skip to content
New issue

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

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

Already on GitHub? # to your account

Adding STRICT_MODE option for jsonpath filters #941

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

Conversation

wildMythicWest
Copy link

Based on Issue 940

If we have some data
Map<String, Object> check = new HashMap<String, Object>(); check.put("item", 3); check.put("null_item", null);

and we use this filter
filter(where("not_existent_item").nin(3)).apply(createPredicateContext(check))
I expect to get false because no such element exists.
Instead the filter returns true.

This PR adds a new STRICT_MODE Option that will validate that all attributes in the filter are present in the json. If an attribute is not present, the filter will return false. This is a fix to NIN specifically. Because NIN inverts the output of IN there is no check if the attribute actually exists in the json.
Adding this mode will not change existing behavior.

@jotarios
Copy link

+1

1 similar comment
@ivakoleva
Copy link

+1

@ivakoleva
Copy link

@kallestenflo Can we merge a strict option? We very much need it

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

Successfully merging this pull request may close these issues.

3 participants