code-corps / code-corps/code-corps-api

Replace json_payload strategy with DockYard's json_api_assert

Aberta
#490 0 comentários 0 reações 0 responsáveis Ver no GitHub
bug feature
Linguagem predominante
Elixir
Estrelas
234
Forks
82
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

# Problem

Our `json_payload` strategy breaks down when the view is not rendering attributes used during record creation. The reason for that is, the strategy takes a built record, infers the view from the type of record and then uses that view to build a json api payload.

If the view does not render an attribute which is usually used to create that record, then creation fails in various ways, depending on the specific case.

I was hoping `ja_serializer` had a convenient helper which would render a record into a json_payload using ALL attributes, and created an issue about that in the repo

https://github.com/vt-elixir/ja_serializer/issues/196#issuecomment-262529168

While the response was that there is no such helper, I was pointed in the direction of https://github.com/DockYard/json_api_assert, which does seem to have such a serializer.

## Subtasks
- [ ] Try to use DockYard/json_api_assert to improve our json_api_payload strategy
- [ ] If that doesn't work, try the reflection route described in the linked issue

## References
* vt-elixir/ja_serializer#196
* https://github.com/DockYard/json_api_assert

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece localizando a estratégia json_payload existente e revisando a discussão vinculada sobre ja_serializer. Avalie DockYard/json_api_assert como substituto e, em seguida, compare-o com a abordagem de reflection; considera-se concluído quando a estratégia consegue construir payloads mesmo que as views omitam atributos usados durante a criação de registros.

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

Avaliação

Stack de tecnologia
elixir
Domínio
testing-qa
Tipo de issue
Refatoração
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
30/100

Receba novas issues na sua caixa de entrada

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