Modify Plugs.DataToAttributes to follow JSON API sideposting draft
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece pelo código DataToAttributes referenciado no issue e revise como JaSerializer.Params.to_attributes lida com relacionamentos belongs-to. Verifique o JSON API sideposting draft e issue #1301 antes de alterar o comportamento. Está concluído quando os relacionamentos de array usam identificadores temp-id para selecionar os registros incluídos correspondentes, enquanto os relacionamentos de map continuam sendo tratados por JaSerializer.Params.to_attributes.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Elixir
- Estrelas
- 234
- Forks
- 82
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de code-corps/code-corps-api
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
code-corps/code-corps-api#1385 ·
-
Cannot Create new GitHub App Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 25/100
code-corps/code-corps-api#1384 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
code-corps/code-corps-api#1383 · 2 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
code-corps/code-corps-api#1382 · 2 comentários ·
-
Difficulty: Medium Skill: Elixir Time: 4 hours
code-corps/code-corps-api#1372 · 3 comentários · 1 responsável ·
Todas as issues de code-corps/code-corps-api
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
agentjido/jido_harness#80 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
sevenseacat/cinder#235 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
phoenixframework/phoenix#6847 ·