JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Filtering included resources

オープン
#314 コメント 4 件 リアクション 9 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Ruby
スター
2.3k
フォーク
546
PR マージ指標
30日以内にマージされた PR はありません

説明

We have a use-case where it would be useful to apply filters to the included resources.

Dummy example:

class UserResource < JSONAPI::Resource
  has_many :socks
  has_many :shoes
end
class SockResource < JSONAPI::Resource
  has_one :user
  filter :in_use
end
class ShoeResource < JSONAPI::Resource
  has_one :user
  filter :in_use
end

Individually, one can filter the shoes and socks
/shoes?filter[in_use]=true
/socks?filter[in_use]=true

I was wondering if it would be possible to filter the shoes and socks when included with the User?

e.g. To get the user, and the shoes and socks he currently has in use, something like:

/users/1?include=shoes,socks&filter[shoes][in_use]=true&filter[socks][in_use]=true

Is this in the scope of jsonapi-resources? or would it be best to find a custom approach?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

UserResource、SockResource、ShoeResource の例から始め、そこに示されている include および filter のクエリパラメーターが現在どのように解釈されているかを確認します。含められたリソースのフィルタリングがサポートされているかを判断します。サポートされた動作が文書化され、カバレッジがあること、またはカスタムアプローチが必要であるという明確な結論に至ることをもって完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rails, ruby
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。