Modify Plugs.DataToAttributes to follow JSON API sideposting draft
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với mã DataToAttributes được tham chiếu trong issue và xem xét cách JaSerializer.Params.to_attributes xử lý các quan hệ belongs-to. Kiểm tra JSON API sideposting draft và issue #1301 trước khi thay đổi hành vi. Hoàn thành có nghĩa là các quan hệ array sử dụng các mã định danh temp-id để chọn các bản ghi included phù hợp, trong khi các quan hệ map vẫn được JaSerializer.Params.to_attributes xử lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Elixir
- Star
- 234
- Fork
- 82
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của code-corps/code-corps-api
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
code-corps/code-corps-api#1385 ·
-
Cannot Create new GitHub App Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
code-corps/code-corps-api#1384 ·
-
Track anon Users that register Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
code-corps/code-corps-api#1383 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
code-corps/code-corps-api#1382 · 2 bình luận ·
-
Difficulty: Medium Skill: Elixir Time: 4 hours
code-corps/code-corps-api#1372 · 3 bình luận · 1 người được giao ·
Tất cả issue của code-corps/code-corps-api
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
agentjido/jido_harness#80 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
sevenseacat/cinder#235 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
phoenixframework/phoenix#6847 ·