Hi,
in the guideline documents I've only noticed JsonPath syntax which looks like this: filter=$.field[...]. In this form, the root of the expression is a single element, while the query is always run against a collection of resources. To my knowledge it is not possible to filter by first level fields using JsonPath in such case.
For example, it is possible to do the following using regular filters: ?field1=val1&field2=val2 but not using JsonPath.
Am I wrong on that? I tested this on websites with interactive JsonPath, and it seems to be this way, for example something like this: filter=$.field1[?(@ == 'val1')] does not work.
If, however, the root of the JsonPath expression would be the collection of resources, rather than its single element, it would be possible to filter by first level fields,
like this: $[?(@.field1=='val1' && @.field2=='val2')].
I think such syntax would fit the use case much better, because the purpose of JsonPath is selection of nodes. Doing this: $.attachment[?(@.size == 100)] in normal JsonPath usage would result in a collection of attachment nodes, rather that document nodes. However this: $[@.attachment.size == 100] fits much better because the selection is done on the collection of documents, so the result is also a collection of documents. Plus it is possible to filter on first level fields. Basically, any query can be made using only JsonPath.
However, usage of JsonPath when root is a collection and not an element of the collection does not appear in the guideline documents, so is it in compliance with TMF?
Best regards
------------------------------
Piotr Ledwoń
Suntech S.A.
------------------------------