Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

RFC: Further reduction of controller boilerplate (Phase 2 of removing ja_resource)

Aberta
#1,069 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
45/100
Tipo de issue
Refatoração
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
elixir
Domínio
api, backend

Direção de pesquisa

Comece lendo o bloco de quote de def controller do módulo CodeCorpsWeb, router.ex e as declarações dos controllers para action_fallback, DataToAttributes e IdsToIntegers. Rastreie como as interfaces de API e webhook diferem atualmente. A tarefa estará concluída quando uma decisão sobre as três mudanças propostas tiver sido alcançada e documentada, sem ocultar comportamento nem aplicar os plugs errados aos webhooks.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

question RFC

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.

Linguagem predominante
Elixir
Estrelas
234
Forks
82
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de code-corps/code-corps-api

Todas as issues de code-corps/code-corps-api

Issues semelhantes

Mais issues de Elixir

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.