JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Permit to filter using the text value of a rails enum

Open
#309 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

I have a rails enum typology: [:foo, :bar]

I can add in the resource a filter :typology and it works when I filter by 0 or 1.

It would be great to recognize that it's an enum and thus accepting also the text version filter[typology]=foo and filter[typology]=bar

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how a resource's filter :typology is parsed and applied, then inspect how Rails enum values are exposed to that filtering path. Verify that filters using foo and bar are accepted alongside 0 and 1, and add or update coverage for both enum text values.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.