JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Documentation for ResourceSerializer with includes is incorrect

Aperta
#1,397 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

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. NOTE - I tried to ask in Gitter but it sends me in an infinite redirect loop when I try to sign in.
  • 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. NOTE - I attempted to create a complete bug report, but I'm not sure how to use the template, and can't seem to find documentation about how it's supposed to be used and my best guess of running ruby rails_5_master.rb doesn't seem to work.
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

Choose one section below and delete the other:

Bug reports:

The documentation says that ResourceSerailizer should be able to include resources by doing something like this:

post = Post.find(1)

JSONAPI::ResourceSerializer.new(PostResource,
  include: ['comments'],
).serialize_to_hash(PostResource.new(post, nil))

But when I do this I don't get an included section in the serialized output.

Additionally I don't find any tests in the test suite that demonstrate the documented way of doing it, but I find several tests that seem to achieve includes via much more verbose and laborious methods.

Am I missing something?

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

Inizia con la sezione include della guida del serializer v0.10 e confronta il suo esempio con test/unit/serializer/serializer_test.rb intorno alle righe 205-226. Riproduci la chiamata documentata a ResourceSerializer, quindi determina se la documentazione o il comportamento del serializer sono errati. Il lavoro è completato quando il workflow include documentato è corretto e coperto da un test mirato.

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

Valutazione

Stack tecnologico
ruby
Ambito
documentation
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.