99designs / 99designs/gqlgen

Crazy plugin idea

Aberta
#3,906 4 comentários 0 reações 0 responsáveis Ver no GitHub
help wanted proposal
Linguagem predominante
Go
Estrelas
10.8k
Forks
1.3k
Merge médio
2d 36min
PRs com merge (30d)
26

Descrição

I want to see what the maintainers think about this idea, I'm okay to pursue on this codebase or others first and merge here as well,

Context:
We sometimes want REST applications for hotpath since the complexity of query parsing from gateway, then in the subgraph does add some CPU overhead. I know what we do inside of the resolver matters, but there are times when it does make a difference.

Currently, the only option is to create a REST version of the same thing duplicating everything.

Since we have resolver that has the dependency anyway, and we have the AST, what I was thinking is generating the REST automatically using a plugin, and one could enable the plugin and decorate using a specific directive to mark the query/mutation as included in the REST version.

Now the way it'd work is by short circuiting the graphql parsing bit, so it'd be basically:
- REST request matches one of the many handler
- handler gets called,
- handler has body that simply calls your resolver without going through the graphql parsing.
- handler serialize the data it gets and returns it back.
- we can provide (just like AroundFields) a way for people to transform the results into REST results (status codes, etc)

What do you guys think? This way we can simply write a service in GraphQL, and then it can also expose REST, (and potentially also generate grpc as well)

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

A issue propõe um plugin para gerar automaticamente endpoints REST a partir de resolvers GraphQL. Comece examinando o sistema de plugins na codebase do gqlgen, especialmente em torno da geração de código e do tratamento do AST. Analise os plugins existentes e como eles se conectam ao pipeline de geração. O estado 'done' seria um plugin funcional capaz de gerar handlers REST para resolvers marcados com uma diretiva, ignorando o parsing de GraphQL.

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

Avaliação

Domínio
api, backend
Tipo de issue
Funcionalidade
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

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