Skip to content

Adding STRICT_MODE option for jsonpath filters#941

Open
wildMythicWest wants to merge 3 commits intojson-path:masterfrom
wildMythicWest:master
Open

Adding STRICT_MODE option for jsonpath filters#941
wildMythicWest wants to merge 3 commits intojson-path:masterfrom
wildMythicWest:master

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

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.

3 participants