JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Allow value with comma to be parsed as single value

Offen
#1,153 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Ruby
Sterne
2.3k
Forks
546
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Create a setting that can be set per resource to disable to automatic parsing of a string with commas into a split array.

Features:

Sometimes, it is a requirement in an API to search by a longer form text field that includes a comma. Currently, when that happens the filter values are translated into an ARRAY whose count is greater then 1 .

Using that array in ActiveRecord causes a WHERE field IN () query to be generated instead of a WHERE field = '' query.

This feature would allow you to override that behavior on a per resource basis

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Einstiegspunkt für das Parsen von Filterwerten und den Konfigurationsmechanismus pro Ressource zu finden; reproduziere dann den ein Komma enthaltenden Filter gegen ActiveRecord. Fertig ist die Änderung, wenn eine Ressource einen Wert mit Komma als einen Wert beibehalten kann, wenn dies konfiguriert ist, während das bestehende Aufteilungsverhalten standardmäßig unverändert bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rails, ruby
Bereich
api, backend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.