Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • 19:56
    clayne11 commented #2173
  • 18:50
    clayne11 synchronize #2173
  • 15:39
    StevenACoffman commented #2173
  • May 16 21:38
    clayne11 synchronize #2173
  • May 16 20:49
    clayne11 opened #2173
  • May 16 19:08
    Panakotta00 commented #1416
  • May 16 16:52
    theverything commented #2147
  • May 16 16:49
    frederikhors commented #2147
  • May 16 16:48
    theverything commented #2147
  • May 16 14:38
    StevenACoffman commented #2147
  • May 16 14:36
    StevenACoffman closed #2157
  • May 16 14:28
    coveralls commented #2157
  • May 16 07:23
    anupriya17 commented #1048
  • May 15 18:48
    adam-stanek opened #2171
  • May 15 14:57
    fletcherist commented #2167
  • May 15 12:09
    StevenACoffman commented #1048
  • May 15 12:05
    StevenACoffman commented #1048
  • May 15 09:10
    frederikhors commented #2169
  • May 15 01:49
    clayne11 opened #2169
  • May 14 23:46
    landrade closed #1048
I define a union type, gqlgen help me generate its interface, but not for implementation of the union type's member type, where am I wrong
it generated a model implementation for the union, that is a interface in golang, but I need the union memeber type has the method defined by the interface
Joana Roque
hello! just wanted to ask if the project is still being maintained and what are the steps one can do to contribute :) the readme just points to this gitter room. I read in an issue that someone requested access to github discussions but there's no link anywhere
Bruno Martinez
I found an issue with the default recovery (func DefaultRecover) in combination with the default ErrorPresenter(DefaultErrorPresenter).
This cause a second panic while recovering from the first one due to a cast error.
I could propose a fix, what are the step to be allowed to contribute or to make a PR ?
Jonatan Magnusson
Hi! I have implemented some subscriptions, and today found a problem: I have subscriptions for bookings and each booking have a nested User. If I request the booking including the user with a normal query, everything works as expected. But if I use the same subfields for a subscription, user is always null.
Is this expected behavior?
I have a custom resolver for Booking.user, which does not seem to be called for subscriptions, but works as expected for queries and mutations.
Nhan Thai
Hi, seems like if I add the directive @goField(forceResolver: true) to a field, gqlgen generates both the resolver and the field inside Go struct. What do I do if I only want the resolver?
For example:
extend type Admin {
    user: User! @goField(forceResolver: true)
then I got both
func (r *adminResolver) User(ctx context.Context, obj *model.Admin) (*model.User, error) {
    panic(fmt.Errorf("not implemented"))
type Admin struct {
    User      *User     `json:"user"` <-- I don't want this
Harry Walter
Is there a hook I can use to intercept between when directives and resolvers run?:
2021/02/28 16:20:14 InterceptOperation
2021/02/28 16:20:14 InterceptResponse
2021/02/28 16:20:14 InterceptField
2021/02/28 16:20:14 Directive: todos
--- Here
2021/02/28 16:20:14 Resolver: Todos
2 replies
I need the directive to add some default value that can then be read in my hook in order to prevent the resolver running or not
Harry Walter
Or is it perhaps possible to hook into the codegen to apply a default directive?
Li Guangsheng
I'm looking for the ability to add any custom struct tags right in gql type defenition. How about 99designs/gqlgen#1173 ?
Mahendra Kumar
Hello, I'm looking for way to add constraint validation directive, but i dont see any example, can anyone help with a link?
Gabriel Balint
Hello, do you guys have any resources for using gqlgen with aws appsync?
Iko Uchiha
Hi everyone

I had a question. Is it possible to have multiple query resolvers?

as in normally, there is one /query route and then one can do say
query {
companies { name }

but I need something like.

because I need to manage access for different user type

Iko Uchiha
in gqlgen yaml file, is there a way to have multiple resolver directory ?
Iko Uchiha
I wanted to split my schema.resolvers.go into multiple packages. across directories. right now in the yaml file, there is a config called resolver: and then it has dir:, and some follow-schema. is it possible to split this into multiple packages. otherwise when there are quite a few domains it becomes cluttery. I could split it across files, but ideally I want like people/schema.resolvers.go and companies/schema.resolvers.go for separation of concerns
Iko Uchiha
is the question wrong?
Christopher Britz
wondering if there is a way in a schema directive function to know when last resolver/value is being run. I do validation for input types using directives ie minLength=1 and want to return an array of gqlerrors instead of one at a time
het jagani
Hi guys, I am having really bad with some problem when I try to decode object in a middleware. I want to access the query string of a object in middleware but I am not able to do so.. You can find the details here 99designs/gqlgen#1527. Can anyone take a look at it. Thanks in advance for any help.
Wisdom Ogwu
Seems people don't get replied often here.
I just defined some unions in my schema file, after running generate, my generated model contained some interfaces.
But my resolvers didn't change e.g. created a union FileResult = File or Error but my resolver still returns type File
How do I make use of unions?
Wisdom Ogwu
Stupid me, I literally didn't change the return value in my schema to fit the union.
Andrew Marine

Hi all. I have been using gqlgen for a while. I am attempting to add to a fairly large project which has been working for a while but now I am running into this error which I have not seen before. This occurs when I try to generate

generating core failed: generated!.gotpl: template: generated!.gotpl:53:38: executing "generated!.gotpl" at <$field.ComplexitySignature>: error calling ComplexitySignature: too many collisions, last attempt was graphql10

It doesnt give me too much to go off of. Where do I start to dig into the root cause of this?

1 reply
Andrew Marine
Our GraphQL server has a number of models where we want to bind to a method on the model instead of generating a resolver on the root resolver. like this. What is the best way to access the database from in the model? Is it possible to have the dependancies injected into the resolver also injected into the model?
Jonathan Duck
Your model method can have a first argument of context.Context. We've used that to pass all sorts of values throughout our app. (DB connection, Session, Logger, etc.). An http/operation middleware can inject the values in the context for all requests.
1 reply
Anthony Lobko
Hi, new here, just wondering how to use the apollotracing handler that's listed https://github.com/99designs/gqlgen/tree/master/graphql/handler/apollotracing . I don't see it documented anywhere how to set it up, but I really wanted to see this kind of telemetry if it's supported
Anthony Lobko
Nevermind, sorted it out
Andrew Ray
I'm trying to figure out how to build the gqlgen project locally. I ran go generate ./... and spat out 4 package lines, then hung for 10 minutes, so I killed it
when I run it again, it spat out some error lines, and now it's hanging again
go: finding module for package github.com/99designs/gqlgen/example/federation/accounts/graph/model tidy failed: go mod tidy failed: exit status 1 exit status 3
should I just be patient, or am I missing a step?
Andrew Ray
the tidy errors went away the second time I ran it, it seems to have generated successfully now
Hi all. Is there any way to write "TYPE DETAILS" in playground docs?

Hi all. Is there any way to write "TYPE DETAILS" in playground docs?

Scalar types has "TYPE DETAILS" but, custom types dosen't have.

John Burke
Hi, I keep getting this error when running go run github.com/99designs/gqlgen generate
resolvergen: package not found for importPath: api/graphexit status 1
Dany Henriquez

I ant to add Gorm fields to the models fo gqlgen. I am trying to figure out where to put the modelgen hook file ad how it is used. Is there a pattern for it?

This is the documentation i am referring to -> https://gqlgen.com/recipes/modelgen-hook/