JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Related endpoints for STI resources do not yield proper types

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

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

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

説明

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?

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

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

はじめの一歩

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

調査の方向性

api/animals と api/zoos/7/animals を比較して、Animal のサブクラス Cat と Dog で STI の動作を再現します。まず関連リソースのエンドポイント処理を追跡してください。関連レスポンスが cats と dogs を有効な JSON:API タイプとして返し、attributes に type を追加せず、警告も発生させなければ完了です。

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

評価

技術スタック
rails, ruby
領域
api, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

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

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