JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Dynamic relationships

オープン
#701 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Type: Enhancement
主要言語
Ruby
スター
2.3k
フォーク
546
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

これまでの議論とリソースリレーションシップのAPIを確認し、提案されているクラスメソッドまたはブロックと、メタデータ駆動の画像例に焦点を当てます。アプリケーションが提供するリンクを引き続きサポートしつつ、includeまたはlinkできるリレーションシップを動的に公開するための受け入れ条件を定義します。このissueではファイルやテストが指定されていないため、実装前にそれらのエントリポイントを特定してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rails, ruby
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。