Questions tagged [gqlgen]

gqlgen is a Go library for building GraphQL servers. Use this tag for questions about using the github.com/99designs/gqlgen library. Use also the [go] tag and tags about web server frameworks you use gqlgen with, as appropriate.

The gqlgen project includes a runnable command that generates Go types from .graphqls schema files and most of the glue code to build a GraphQL server.

The gqlgen repository is located at: https://github.com/99designs/gqlgen

79 questions
2
votes
0 answers

Generating a GraphQL schema from a JSON schema in GoLang

I am new to Go and GraphQL and was wondering if it is possible to programmatically build the schema from a JSON schema fetched from an endpoint. I am currently looking to use gqlgen which allows for manually defining your schema via SDL (Schema…
2
votes
0 answers

How to configure Kubernetes liveness, readiness, and startup probes in Go's (GraphQL) gqlgen

I'm using Go and gqlgen to implement a GraphQL API. The application will be deployed, eventually, in a Kubernetes cluster, so I started looking for a way to configure the usual liveness, readiness, and startup probes. I've searched for solutions but…
x80486
  • 6,627
  • 5
  • 52
  • 111
2
votes
1 answer

Unable to run gqlgen generate due to missing go.sum entry for module

I'm following the tutorial at https://blog.logrocket.com/gqlgen-build-faster-graphql-server/ and gqlgen init runs fine. Following the guide, I'm trying to generate new schemas and resolvers (adding the Dog type) using go run…
oalmgren
  • 415
  • 7
  • 19
2
votes
0 answers

How can I provide input field arguments with apollo federation 2?

I am trying to federate two of my micro services with apollo gql federation 2. I have successfully connected the two services through the federation with the following schemas: Subgraph1 - Product type Product @key(fields: "id") { id: ID! …
CaminoDS
  • 41
  • 4
2
votes
1 answer

How to limit the amount of the alias in gqlgen library Go

I'm using gqlgen package to create GraphQL server. However, I can't limit the amount of the alias. FixedComplexityLimit limits the complexity of the query. It is possible in JS community thanks to graphql-no-alias npm package. I need that kind of…
2
votes
0 answers

auth error using gqlgen and gin returns an empty response

There are no recipes for this which is surprising as it seems like a pretty basic use case. If a request does not have a valid token, we want to return a 403 to the user. But trying to do that results in an empty response and "missing response…
2
votes
1 answer

How to resolve "Error fetching schema" in gqlgen

Good day, i am new to go and i am trying to build a graphql service with go, i did this using the go gqlgen package. Now when install and generate necessary files the initial start up, i can see the default TODO schema and resolver on the docs tab,…
2
votes
1 answer

Golang gqlgen, fetching separate fields in a single DB query via Dataloading

I am trying to see if its possible to take several fields that have their own resolver and somehow get them in a single DB query since they are fetched from the same place. Eg. the schema type ExampleResposne { A: Int! B: Int! C: Int! } The…
Nikola-Milovic
  • 1,393
  • 1
  • 12
  • 35
2
votes
1 answer

gqlgen go, reduce db calls by adding one resolver

I'm having some trouble resolving a specific situation which results in performances reduction. I'm quite sure that is something which can be done, but I can't figure oute how to do it. Here's an example schema for exposing the problem: type…
L. Gangemi
  • 3,110
  • 1
  • 22
  • 47
2
votes
1 answer

Can't generate scalar JSON in gqlgen

I have a GQL scheme: extend type MyType @key(fields: "id") { id: ID! @external properties: JSON @external myField: String! @requires(fields: "properties") } scalar JSON In graph/model/model.go: package model import ( "encoding/json" …
user8439944
  • 73
  • 1
  • 7
2
votes
1 answer

How to resolve a Graphql Union with Gorm?

I have a union on two concrete types Prodotto and ProdottoVariante both implements a interface of type Articolo. union Articoli = Prodotto | ProdottoVariante extend type Query { articoli: [Articoli!]! } I want to query all Prodotto and all…
ctrlmaniac
  • 404
  • 4
  • 13
  • 28
2
votes
0 answers

Go and Grapqhl setup not working on mac in documents folder

I was following this tutorial https://www.howtographql.com/graphql-go/1-getting-started/ and had a hard time getting it to work. First, i tried all this in a subfolder of my Documents folder. However, after step go run github.com/99designs/gqlgen…
Ferdi K
  • 31
  • 2
2
votes
1 answer

Graphql Subscriptions not working with Gin

When I tried to setup a Go web server with GraphQL I used this as template. It is basically a combo of gin and 99designs/gqlgen. When I create a basic gqlgen server based on net/http package, the declaration of GraphQL subscriptions work as…
Willey3x37
  • 310
  • 2
  • 12
2
votes
1 answer

How to get all fields in a response in graphql without passing any field names in a query

I'm building a graphql interface using golang. I'm using gqlgen package to implement it. Here I need to pass all field names in a query to get it in response, But the problem is my data is huge, it is having more than 30 fields it would be difficult…
Deepak Deepu
  • 31
  • 1
  • 3
2
votes
0 answers

Forward header to implementations

I'm building a graphql api with gqlgen and apollo federation as a gateway. in gqlgen, I have three services: static page, accounts, auth. And I'm using apollo federation as a gateway. For the auth section I need to get Authorization header like…
Gep Gecici
  • 77
  • 1
  • 8