jsonapify
jsonapify copied to clipboard
Provide example usage for transaction filters
Hi, Can you add a transaction filter example to the readme, or point me in the direction of an example of how they should be used? I've been unable to figure out so far how to add pagination or sorting when using jsonapify.enumerate.
Each middleware accepts an options object as an optional argument. You can provide your transaction filters as jsonapify.enumerate('YourModel', { filters: [yourFilters] });
. There's no documentation yet because we were considering adding an option for configurable global default filters via the Runtime class, but we have not decided on the definitive semantics yet.
Thanks for this, that gives me enough to work with regarding filters. I also see now that there are some filters enabled by default in the enumerate middleware, when none are provided.
It seems, however, that when I try and use the default paginateOffset filter, supplying something like ?page[offset]=0&page[limit]=10
, I get an error stating that the "'skip' field must be numeric" (and I can see from the message that my "0" and "10" were parsed as strings) -- Is this possibly user error? I can certainly dig a little and see if I can determine why this happens for me.