JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Dynamic relationships

Abierto
#701 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Type: Enhancement
Lenguaje dominante
Ruby
Estrellas
2.3k
Forks
546
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I am using JR for my project finally. I have a requirement which has been talked about before, which I intend to implement myself, but would like to know if this project is interested in receiving it too. If so, I will develop it on a branch, otherwise I will write a custom extension that will live in my app.

In summary, I require that relationships can also be dynamic rather than hard coded using has_many etc..
The idea being that the client side is helped significantly if we translate something that may end up being either complex to read or maybe would require a number of http requests - into a simple relationship that the client can use easier.

Probably best to use an example

Say we have some metadata in our AR model and that meta data has a definition of "some objects of type 'image' with ids 1,2,3,4,5,6", keyed by the name "my_images". Whilst this could be read by the client, they would then have to make decisions on the type, then go and fetch those images themselves.
We want "my_images" to be a relationship that can be included or linked to as normal (we would have to rely on the application to provide the links though as JR could not possible calculate them itself)

I was thinking of an implementation in the resource as a class method that is passed a block which says "define dynamic relationships" and the block could return maybe an array or relationships to define or something like that - but I haven't thought that much into it yet.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Revisa la discusión anterior y las APIs de relaciones de recursos, centrándote en el método de clase o bloque propuesto y en el ejemplo de imagen basado en metadatos. Define los criterios de aceptación para exponer dinámicamente una relación que pueda incluirse o vincularse, manteniendo el soporte para los enlaces proporcionados por la aplicación; el issue no nombra archivos ni tests, por lo que debes localizar esos puntos de entrada antes de la implementación.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rails, ruby
Área
api, backend
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
20/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.