Closed JohnWhitleyEkkoSense closed 5 years ago
Hi @JohnWhitleyEkkoSense - Thanks for giving orbit a try and for your kind words.
The (overly) simple answer to your question is that usage of lt
is not defined by the JSON:API spec, so it is a bit tricky to define this behavior only on the client-side with no guarantee that servers will understand how to interpret these filters.
There is good news on the horizon though. JSON:API v1.1, which is in final draft now, supports the concept of "profiles" which allow for more opinionated interpretation of the spec. This will unlock the ability for clients and servers to share an understanding of filters and other under-specified areas of the base spec. For example, there's already an issue open (#479) to consider supporting Drupal's concept of "fancy filters". If that doesn't work for you, you can also define your own filter profile and be able to tweak the JSONAPISource to support it ...
Which brings me to my last point: extensibility. We're revamping the standard orbit sources for v0.16 to better support custom interpretations of requests. You'll soon be able to more easily override query and update operators for sources. I expect to get a beta release of v0.16 out soon so you can experiment with it.
It's now possible to create a custom JSONAPIURLBuilder
class and pass that in as an option to your JSONAPISource
.
You can customize the buildFilterParam
method to account for whatever filtering scheme your server supports.
As I mentioned earlier, I'll be glad to include some advanced filtering behaviors in the base implementation once there's an associated JSON:API profile (or two) that defines those behaviors.
For anyone looking for something like this (e.g., for Drupal's fancy filters) in the meantime:
Hello,
Thank you for your work on this library. We are looking at creating a robust client side API, and would like to use orbit. We have a working proof-of-concept and have been impressed with many aspects including the structure, the speed of development of our client side code that orbit provides; and the thinking around stores and coordinators.
We are now looking at the filtering parameters being passed up to the server: it appears that we can only send the "equal" filter operator to JsonAPI. When we attempt to pass a different filter operator:
we get:
Query expression parse error: Filter operation lt not recognized for JSONAPISource.
Many thanks in anticipation of your input.