JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Related endpoints for STI resources do not yield proper types

Aperta
#772 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Following up on #507

Given a model Animal with subclasses Cat and Dog, types get returned properly when querying directly for animals - e.g. hitting endpoint "api/animals" responds with types "cats" and "dogs" in the payload.

However, this behavior is not consistent when hitting the related endpoints of a resource - e.g. hitting "api/zoos/7/animals" responds with only type "animals" in the payload.

Currently, I am including "type" in the attributes object, which raises a warning and also breaks the JSON API specs. Is there a better workaround for this?

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

Riproduci il comportamento STI con le sottoclassi di Animal Cat e Dog confrontando api/animals con api/zoos/7/animals. Traccia prima la gestione dell’endpoint delle risorse correlate; il lavoro è completato quando la risposta correlata segnala cats e dogs con tipi JSON:API validi, senza aggiungere type agli attributi né generare un avviso.

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

Valutazione

Stack tecnologico
rails, ruby
Ambito
api, backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.