Modify Plugs.DataToAttributes to follow JSON API sideposting draft
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comience con el código DataToAttributes referenciado en el issue y revise cómo JaSerializer.Params.to_attributes gestiona las relaciones belongs-to. Compruebe el JSON API sideposting draft y issue #1301 antes de cambiar el comportamiento. Se considera terminado cuando las relaciones de array usan identificadores temp-id para seleccionar los registros incluidos coincidentes, mientras que las relaciones de map siguen siendo gestionadas por JaSerializer.Params.to_attributes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Elixir
- Estrellas
- 234
- Forks
- 82
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de code-corps/code-corps-api
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
code-corps/code-corps-api#1385 ·
-
Cannot Create new GitHub App Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
code-corps/code-corps-api#1384 ·
-
Track anon Users that register Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
code-corps/code-corps-api#1383 · 2 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
code-corps/code-corps-api#1382 · 2 comentarios ·
-
Difficulty: Medium Skill: Elixir Time: 4 hours
code-corps/code-corps-api#1372 · 3 comentarios · 1 asignado ·
Todos los issues de code-corps/code-corps-api
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
agentjido/jido_harness#80 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
sevenseacat/cinder#235 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
phoenixframework/phoenix#6847 ·