RFC: Further reduction of controller boilerplate (Phase 2 of removing ja_resource)
還沒有人認領這個 Issue。
評估
研究方向
先閱讀 CodeCorpsWeb 模組的 def controller quote 區塊、router.ex,以及 action_fallback、DataToAttributes 和 IdsToIntegers 的 controller 宣告。追蹤 API 介面與 webhook 介面目前的差異。完成的標準是針對提出的三項變更作出決定並加以記錄,不得隱藏行為,也不得將錯誤的 plugs 套用至 webhook。
由索引模型根據 Issue 內容生成。
描述
We could do the following 3 items to further reduce boilerplate in controllers.
However, while boilerplate is reduced, all 3 of these actions also hide behavior which we may not want to hide.
Remove action_fallback CodeCorpsWeb.FallbackController from all controllers and instead move it into the CodeCorpsWeb module into the def controller quote block
This makes sense at first glance, but it does also put all of our controllers into basically the same basket, regardless of them being actual API controllers, or just webhook handlers, or something else entirely.
Unfortunately, it is not currently possible to specify multiple action fallbacks for the same controller, which would be an argument for doing this, since it would allow simultaneously specifying global and group-specific fallbacks.
Remove plug CodeCorpsWeb.Plug.DataToAttributes from all controllers and move it into router.ex into the :api pipeline.
We would have to separate our general api pipeline and the part of the pipeline that handles github and sprite webhooks, since we don't want this plug in that part, but it would make sense to do so anyway, since they are, in fact, different parts of the "interface".
Remove plug CodeCorpsWeb.Plug.IdsToIntegers from all controllers and move it into router.ex into the :api pipeline.
Basically same argument as above.
Really, these two plugs should be considered one pipeline, since their intention is to prepare and make sense of the data sent by our client.
@JoshSmith
What do you think? Overall, this would not take much time, maybe an hour, but I'm not really sure if it would help or hurt us.
- 主要語言
- Elixir
- 星號
- 234
- 分支
- 82
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
code-corps/code-corps-api 的其他 Issue
-
難度 5/5 一週以上 新手友好度 15/100
code-corps/code-corps-api#1385 ·
-
難度 3/5 1-2 天 新手友好度 25/100
code-corps/code-corps-api#1384 ·
-
難度 4/5 3-5 天 新手友好度 35/100
code-corps/code-corps-api#1383 · 2 則留言 ·
-
難度 3/5 1-2 天 新手友好度 35/100
code-corps/code-corps-api#1382 · 2 則留言 ·
-
Difficulty: Medium Skill: Elixir Time: 4 hours
code-corps/code-corps-api#1372 · 3 則留言 · 已指派 1 人 ·
查看 code-corps/code-corps-api 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
carverauto/serviceradar#4596 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
bug
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 1-3 小時 新手友好度 75/100
agentjido/jido_harness#80 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
sevenseacat/cinder#235 ·