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
1
vote
0 answers

gqlgen write a middleware to get only query of operation name

I have a private GrapgQL API and I want to write a small public GrapgQL API to consum a few queries/mutations of private API. From my public resolver give a query to private GrapgQL API, I would like to take the query and its fields, parameters and…
eclaude
  • 846
  • 14
  • 30
1
vote
1 answer

Proper way to return string pointers in Graphql API

I'm building a graphql API using 99designs/gqlgen but I'm a bit confused about the proper way of returning pointers. The graphql type type GraphType { image_url: String } The go code is: type GraphType struct { ImageURL *string…
siper92
  • 23
  • 4
1
vote
1 answer

How do I ensure that a form submitted File can be read properly as part of fetch?

I've been utilizing File Upload from GQLGen in a project. Back end is set up fine, but I keep getting a map[string]interface {} is not an Upload response from the server when fetch'ing from my front end. I noticed when checking the sent payload that…
user2781522
  • 119
  • 10
1
vote
1 answer

How to make gqlgen dataloader Loader.Load(key) return a function that returns an explicit data type instead of interface{}?

I want to use graph-gophers/dataloader to implement a dataloader for bulk-fetching users. I have implemented it like below but I need to return an explicit data type, not an interface{} Firstly, I create UserReader with function GetUsers by given…
loc.dang
  • 374
  • 3
  • 19
1
vote
0 answers

Apollo Websocket repeatedly attempts to connect over and over when updating context

I'm using Apollo on my frontend to manage queries and GQLgen on the backend to handle resolvers. I've noticed this only occurs if webSocketInit returns a new ctx value. If I return the original ctx, everything works as expected. //main.go …
Nicole Staline
  • 557
  • 4
  • 15
1
vote
1 answer

Federated graphql context with gqlgen

How do you get the graphql context in a gqlgen subgraph that has been passed down from the federated graphql gateway?
hboylan
  • 357
  • 3
  • 12
1
vote
0 answers

Heroku Deploy Gqlgen golang Unexpected token < in JSON at position 0

i tried deploying my golang server to heroku automatically, and the server runs until the playground. i use gqlgen from graphql golang but when i try to run the query and i fetch data in playground, i find the problem as below. {"errors":…
1
vote
0 answers

GQLGen related list query limit using entgql

I'm using entgql implementation of gqlgen (https://entgo.io/docs/graphql/) and have run into an issue where after my query reaches a certain size, it starts returning related lists as empty lists. Rough data as follows type Partner implements Node…
skeletalmonkey
  • 726
  • 1
  • 10
  • 20
1
vote
1 answer

99designs / gqlgen get child parameters from rctx

I need to get the child parameter value from Graphql. Here is my Graphql query: { foods(type: "fries") { drinks { calorie(joule :1500) { name } } } } I can get the type field easily but also I need to get the joule…
1
vote
1 answer

Golang: generating core failed: unable to load github.com

I installed golang and started with this tutorial: https://www.howtographql.com/graphql-go/1-getting-started/ When I run: go run github.com/99designs/gqlgen generate I get: reloading module info generating core failed: unable to load…
DenCowboy
  • 13,884
  • 38
  • 114
  • 210
1
vote
0 answers

gqlgen Resolver func missing OrderBy args in generated code

I am new to go. I am building a project using gqlgen and ent. I have schema.graphql defined as below type IP implements Node { id: ID! created_at: Time! updated_at: Time! response_code: String! ip_address: String! queries(after: Cursor,…
Sujith Shajee
  • 175
  • 5
  • 18
1
vote
0 answers

How to filter the inner Nodes with gqlgen

I am using gqlgen to generate boilerplate for graphql queries. How do I generate a resolver for the inner nodes? For instance, I have a Region schema with [school] array but I also need a filter for the school array. School schema contains classes…
Forkmohit
  • 733
  • 3
  • 12
  • 31
1
vote
2 answers

Getting WebSocket connection to 'ws://localhost:7080/query' failed on connecting graphql-ws client with gqlgen golang server

The subscription query listed below in code working fine on graphql playground but when i tried to connect my graphql-ws client with gqlgen driven go server, i got WebSocket connection to 'ws://localhost:7080/query' failed error. I tried connecting…
Sahil Aggarwal
  • 129
  • 1
  • 1
  • 12
1
vote
0 answers

Unit tests for GraphQL resolvers

I want to write unit tests for GraphQL api (gqlgen) in go (I checked the functionality in GraphQL playground and everything works) Schema type Farmer { id: Int! name: String! surname: String! dob: Date! fin: String! …
Helen Grey
  • 439
  • 6
  • 16
1
vote
1 answer

Cannot add http headers to gin client (Resolver context)

I want to add headers to the request for testing. Further, I want to move any headers I want to access in resolvers into context. PR #861 featured a way to add HTTP headers across a whole client or per request. This does not work for me. I tried…
yashjain12yj
  • 723
  • 7
  • 19