Modify Plugs.DataToAttributes to follow JSON API sideposting draft
まだ誰も着手していません。
評価
調査の方向性
Issue で参照されている DataToAttributes コードから始め、JaSerializer.Params.to_attributes が belongs-to リレーションをどのように処理しているかを確認してください。動作を変更する前に、JSON API sideposting draft と issue #1301 を確認してください。完了条件は、array リレーションが temp-id 識別子を使用して一致する included レコードを選択し、map リレーションは引き続き JaSerializer.Params.to_attributes で処理されることです。
索引モデルが issue の本文から書いたものです。
説明
Problem
Our current approach with included records is to simply assume they are related to the main record.
Based on the draft
- included record payloads should have
temp-idproperties if they are to be created. - the main record payload should have a relationship where the identifier is
%{data: [%{"temp-id" => "foo", "type" => "bar"} - the plug should get those identifiers, then replace the identifier payloads with the associated full payloads matched in included
Subtasks
- instead of just taking any
includedrecords and assuming they're relationships in the resulting params map,DataToAttributesshould parse therelationshipsmap first- the relationship where
datais a map is a belongs to and should be left alone. it's already handled byJaSerializer.Params.to_attributes - the relationship where
datais an array should be checked for identifiers withtemp-idkeys- each
temp-idshould be found in theincludedsection and added under the pluralized relationship key in the resulting map
- each
- the relationship where
An advantage of this is that we now are able to conclude it's definitely a has_many, so we do not need to explicitly specify this anymore.
References
The code this needs to modify is part of #1301 so this is blocked until that is merged.
- 主要言語
- Elixir
- スター
- 234
- フォーク
- 82
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
code-corps/code-corps-api のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
code-corps/code-corps-api#1385 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
code-corps/code-corps-api#1384 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
code-corps/code-corps-api#1383 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
code-corps/code-corps-api#1382 · コメント 2 件 ·
-
Difficulty: Medium Skill: Elixir Time: 4 hours
code-corps/code-corps-api#1372 · コメント 3 件 · 担当者 1 名 ·
code-corps/code-corps-api の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
agentjido/jido_harness#80 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
sevenseacat/cinder#235 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
phoenixframework/phoenix#6847 ·