JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

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

Aperta
#125 1 commento 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Type: Enhancement
Lingua principale
Ruby
Stelle
2.3k
Fork
546
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Traccia la gestione esistente di GET /users?filter[first_name] fino alla conversione in User.where. Esamina come vengono analizzati i nomi e i valori dei filtri, quindi determina il comportamento previsto per i filtri starts-with, ends-with, contains e not-equal. Il lavoro è completato quando le quattro forme di query proposte sono supportate con una copertura corrispondente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rails, ruby
Ambito
api, backend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.