JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Feature Request: built in support for non where/in filtering
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Out of the box, JR takes this:
GET /users?filter[first_name]=Yehuda
and turns it into the equivalent of this:
User.where(:first_name => ["Yehuda"])
Although JSON API spec is agnostic about filter implementation, I propose introducing some naming patterns for "starts with", "ends with", "contains", and "not in" type attribute filters.
Examples
Get all users with a first_name that starts with "ye":
GET /users?filter[first_name^]=ye
Get all users with a first_name that ends with "huda":
GET /users?filter[first_name$]=huda
Get all users with a first_name that contains "hud":
GET /users?filter[first_name~]=hud
Get all users with a first_name that is NOT "Yehuda":
GET /users?filter[first_name!]=Yehuda
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the existing handling of GET /users?filter[first_name] through the conversion to User.where. Review how filter names and values are parsed, then determine the expected behavior for starts-with, ends-with, contains, and not-equal filters. Done means the four proposed query forms are supported with matching coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100