JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Nested included resources filters

Open
#1,255 0 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

This issue is a (choose one):

  • Problem/bug report.
  • Feature request.
  • Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.

Checklist before submitting:

  • I've searched for an existing issue.
  • I've asked my question on Gitter and have not received a satisfactory answer.
  • I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

Hi guys, I'm sorry about how this issue is looking, don't have time to make it better.
Currently, (checked on 0.9.5, and it's probably the same on 0.9.7) filtering on nested resources works only for 1 level deep inclusion, i.e. included_resource.filter_key. I made some monkey-patches in my app, to make it work with nested resources inclusion, i.e. included_resource.another_included_resource.filter_key.
Also, I did some changes to make filters work with has_one relationships.

The code can be a little bit messy, but it's working, at least for my project. No blame, please :)

The code is here: https://gist.github.com/RoM4iK/1ce4eab45ed0ceafa8728ed487ccddbb

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 reviewing the linked Gist and locating the existing resource-filtering entry point in the repository. Compare the current one-level nested-resource behavior with the requested deeper nesting and has_one relationships. Done means nested filters work at multiple inclusion levels, including has_one resources, with project tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.