JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Nested attributes for relationships
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Ruby
- Estrellas
- 2.3k
- Forks
- 546
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
If I were updating / creating a "post" and I also wanted to create / update tag id 3 in the example below, should that be possible (i.e. similar to nested attributes in active record).
Probably a bit of a bad example, but hopefully you get the idea ?
I am finding that each entry in "data" in the relationships must only contain id and type. Nowhere have I yet seen how to do this in json_api in general, not just in this gem so maybe it is not possible. In which case, I guess I would need to create / update the tag seperately, but then I may need to worry about rolling it back if the creation / update of the post did not succeed etc...
post '/posts',
{
'posts' => {
'attributes' => {
'title' => 'A great new Post'
},
'relationships' => {
'tags' => {
'data' => [
{type: 'tags', id: 3, attributes: {name: "New Tag Name"}},
{type: 'tags', id: 4}
]
}
}
}
}
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
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.
Línea de trabajo
No se ha indicado ningún archivo fuente, prueba ni punto de entrada. Empieza revisando el manejo existente de la creación y actualización de relaciones y las reglas de JSON:API para los datos de relaciones; después, determina si se admiten atributos anidados. El trabajo estará terminado cuando haya una decisión clara, con el comportamiento de las solicitudes y las expectativas de transacción o rollback definidos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rails, ruby
- Área
- api, backend-api-design
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100