JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Feature Request: built in support for non where/in filtering

オープン
#125 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る

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

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

説明

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

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

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

はじめの一歩

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

調査の方向性

GET /users?filter[first_name] の既存の処理を User.where への変換まで追跡してください。フィルター名と値がどのように解析されるかを確認し、starts-with、ends-with、contains、not-equal フィルターに期待される動作を判断してください。4 つの提案されたクエリ形式が対応され、それに一致するカバレッジがあることを完了条件とします。

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

評価

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

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

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