First, the all attention from previous posts above regarding JSON-Path is about recommendation, which especially flies for any newly introduced API. It is surely understood legacy APIs already in place have the original filter pattern, and are yet to support.
Then, there is a reason why multiple values can be passed only in the case of strict equality: it is not meaningful for other operators (e.g. attr>val1,val2 is basically same as attr>val where val is min(val1,val2)).
Original Message:
Sent: Oct 11, 2023 02:57
From: Piotr Ledwoń
Subject: What is the expected behavior of a filter when AND is mixed with OR?
Thanks, your answers clarified most of the issues.
I understand that jsonPath might be better for writing queries, but I am writing a parser for the query string. One thing still is unclear to me. You wrote:
"Multiple values can be passed only in the case of strict equality (=). In this case, the logical OR operation is performed over the list of comma-separated values.".
I understand it like this: attr=val1,val2 is OK, attr>val1,val2 is not. However, what about attr=value1&attr=value2? It is stated in TMF630 4.4 that it should result in oring, so unless it will be changed in later revisions, this should also be supported. Can I mix it with other conditions? Can I just assume, that whenever it appears within one AND condition, it just collapses to OR, like in the example below?
E.g. attr1=val1&attr2=val2&attr1=val3;attr4=val4 => attr1=val1,val3&attr2=val2;attr4=val4
------------------------------
Piotr Ledwoń
Suntech S.A.
------------------------------
Original Message:
Sent: Oct 11, 2023 01:44
From: Christophe MICHEL
Subject: What is the expected behavior of a filter when AND is mixed with OR?
Echoing Vance on top of my previous post:
In addition to the below examples, each filter query can also support JSON Path as 'filter' selector, e.g. "?filter=childResource[?(@.attribute==value)]", to apply for multiple occurences matching childResource.attribute==value.
Example (same as previous):
catalog/item?filter=size==90,100&price<10;size==110&price>100 (non encoded)
is similar to JSON Path:
catalog/item?filter=$[?((@.size==90||@.size==100)&&@.price<10)],$[?(@.size==110&&@.price>100)]
which is indeed much more flexible approach.
------------------------------
Christophe MICHEL
Amdocs Management Limited
Original Message:
Sent: Oct 11, 2023 01:34
From: Vance Shipley
Subject: What is the expected behavior of a filter when AND is mixed with OR?
Complex queries should be done using JSONPath syntax as described in TMF630 Part 6 JSON Path extension. This provides a clear syntax for arbitrarily complicated queries.
Note that the IETF Working Group on JSON Path recently submitted a final draft IETF standard to IESG for Publication as an RFC. The next version of TMF630 Part 6 should be refactored to align and reference with this standard, so we have very clear guidance.
------------------------------
Vance Shipley
SigScale