JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Documentation for ResourceSerializer with includes is incorrect

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

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

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

説明

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?

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

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

はじめの一歩

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

調査の方向性

v0.10 serializer guideのincludeセクションから始め、その例をtest/unit/serializer/serializer_test.rbの205〜226行付近と比較してください。ドキュメントに記載されたResourceSerializerの呼び出しを再現し、そのうえでドキュメントとserializerの動作のどちらが誤っているのかを判断してください。ドキュメントに記載されたincludeワークフローが正確で、焦点を絞ったテストでカバーされていれば完了です。

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

評価

技術スタック
ruby
領域
documentation
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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