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
1 answer

How can I set the type for model.fields?

How can I set the type for model.fields in gqlgen? I used model.Fields[0].Type here and I want just to use string here: // Defining mutation function func mutateHook(b *modelgen.ModelBuild) *modelgen.ModelBuild { for _, model := range b.Models…
2
votes
0 answers

Testing GraphQL Go Server Using a Go Client

I'm using github.com/99designs/gqlgen to generate my server side Go code. This works correctly and I am able to interact with my queries, mutations, etc... using the built in GraphQL Playground. Now I'm trying to write tests in Go for the server.…
Przemek Lach
  • 1,348
  • 2
  • 19
  • 42
2
votes
1 answer

Pass Graphql input arguement to directive

I have a simple graphql query and a directive directive @isOwner(postID: String!) on FIELD_DEFINITION type Query { post(postID: String!): Post! @isOwner(postID: postID) } The problem is that I'm using GQLGen to generate my boilerplate code for…
Kisinga
  • 1,640
  • 18
  • 27
1
vote
1 answer

not able to generate generated_sort.go from gqlgen-sqlboiler

I am using sqlboiler version: v4.14.2 gqlgen version: v0.17.33 gqlgen-sqlboiler version : v3.3.12 https://github.com/web-ridge/gqlgen-sqlboiler After following readme.md pre requisite getting following error while running convert.go following is…
Rupesh Terase
  • 440
  • 3
  • 14
1
vote
0 answers

Graphql/ gplgen --Golang returning Empty metadata array in response

Resolver: func (r *queryResolver) GetProducts(ctx context.Context) ([]*models.Product, error) { products := []*models.Product{ { ID: "1", Name: "Vingate Sofa", Image: …
1
vote
1 answer

gqlgen and dependency injection using golang

im using gqlgen lib to implement a graph ql server .. the following setup code is straigthforward port := os.Getenv("PORT") if port == "" { port = defaultPort } graphCfg := graph.Config{ Resolvers:…
Mortalus
  • 10,574
  • 11
  • 67
  • 117
1
vote
0 answers

GraphQL+Go file upload error with Scalar Upload

I need to upload a file using GraphQL. I declare a Scalar Upload to do this in a .graphqls file: Scalar Upload Mutation { ... } But when I try to make a request to the server, I get an error: Unknown type “Upload” How can I fix this error…
Stepan
  • 11
  • 1
1
vote
1 answer

gqlgen CORS refusing connection from http://localhost:3000

I'm trying to add CORS to my gqlgen server using the code from the official docs, but when I try to connect to the server from http://localhost:3000 the connection is refused. package main import ( "log" "net/http" "os" …
megajon
  • 37
  • 2
1
vote
0 answers

ENTGQL go generate ./... UUID Error (error calling gqlIDType)

I have a problem. I'm trying to integrate entgo with gqlgen, and my go generate ./... command doesn't work. It throws an error below running ent codegen: execute template "client": template: node.tmpl:315:16: executing "client/fields/additional" at…
Nicolas
  • 13
  • 2
1
vote
0 answers

WebSocket connection to 'ws://localhost:8080/' failed: error while trying to do a subscription

i'm using Apollo graphgql Client for front-end and gqlgen for my bff service here's my Apollo configuration code: const wsLink = new GraphQLWsLink(createClient({ url: 'ws://localhost:8080/'})) and here is how i created my graphql server: srv :=…
1
vote
1 answer

Cannnot do "gqlgen generate"

First, I initialized gqlgen. go run github.com/99designs/gqlgen init Second, I fixed resolver.go and schema.resolvers.go And, I execute this. Then error has occurred. $ go run github.com/99designs/gqlgen generate reloading module info modelgen:…
1
vote
1 answer

How to upload large files to a 99designs/gqlgen backend

I want to upload large files to my backend which I created with gqlgen. To do that, I want to use multipart requests to keep only one endpoint. (Client implementation e.g. apollo-upload-client) There is an example and documentation on how to upload…
Gianluca Filitz
  • 371
  • 1
  • 2
  • 10
1
vote
0 answers

gqlgen websocket not close if initFunc returns an error

I'm using gqlgen for my GraphQL API and I have some subscription (websocket) in my API. But it's not working as expected: When initFunc of the transport.Websocket{} return an error the websocket is not close but spam the init function. I would have…
cylon86
  • 550
  • 4
  • 20
1
vote
1 answer

GraphQL Interface With GqlGen

I'm trying to implement the GraphQL Interface by using Go GqlGen but it's not working. I'm getting following error: "errors": [ { "message": "json: cannot unmarshal object into Go struct field Segment.segments.contents of type…
Shashank Sachan
  • 520
  • 1
  • 8
  • 20
1
vote
1 answer

skip Preload in gorm / graphql

I am currently passing some tutorials about creating a Graphql server with gqlgen and gorm (mysql server). Here is my code type Player struct { ID string `json:"id"` Name string `json:"name"` TeamID int `json:"team_id"` } type…
user1908375
  • 1,069
  • 1
  • 14
  • 33