Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support alternate filter parsers #378

Open
JesseDocken opened this issue Apr 25, 2024 · 0 comments
Open

Support alternate filter parsers #378

JesseDocken opened this issue Apr 25, 2024 · 0 comments

Comments

@JesseDocken
Copy link

So JSON-API apparently left the world to it's own devices when it came up with the concept of "filters" without defining any idea of what the structure for these should look like. As a result, our existing JSON-API applications use the following style for filtering resources:

/resource?filter[field1][$op]=value1&[field][$op]=value2

For example, to search for users between the ages of 24 and 45:

/users?filter[age][$gte]=24&filter[age][$lte]=45

In KurierJS, this would instead look like:

/users?filter[age]=ge:24&filter[age]=le:45

Both are in total compliance with the spec and obviously I have no desire to ask that KurierJS conform to how our existing application stack works today. However, it would be awesome if we could leverage KurierJS in our applications going forward while still maintaining compatibility with how our other applications work, especially since our frontends are all designed to work around that style of querying. If there was a way to inject a new filter parser into the Application, that would resolve our issue perfectly.

This isn't blocking us; currently the former gets read in and it mangles the keys a bit, but it works and I can convert it into a more readable format. But it's definitely not ideal and could be cleaner.

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

No branches or pull requests

1 participant