Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 10:04
    chedom synchronize #1833
  • 08:57
    chedom synchronize #1833
  • 07:04
    coveralls commented #1839
  • 07:04
    Code-Hex edited #1839
  • 07:03
    Code-Hex opened #1839
  • 06:56
    Code-Hex edited #1838
  • 06:55
    coveralls commented #1838
  • 06:55
    Code-Hex edited #1838
  • 06:54
    Code-Hex edited #1838
  • 06:53
    Code-Hex opened #1838
  • Jan 23 16:40
    StevenACoffman commented #1751
  • Jan 23 04:31
    giautm commented #1751
  • Jan 22 18:39
    StevenACoffman commented #1751
  • Jan 22 18:37
    StevenACoffman commented #1751
  • Jan 22 16:56
    StevenACoffman closed #1836
  • Jan 22 16:55
    StevenACoffman commented #1835
  • Jan 22 16:55
    StevenACoffman closed #1835
  • Jan 22 16:55
    StevenACoffman closed #1724
  • Jan 22 16:55
    StevenACoffman closed #1090
  • Jan 22 16:55
    StevenACoffman closed #1834
Jonatan Magnusson
@jomag
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
@dandoh
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"))
}
and
type Admin struct {
    ...
    User      *User     `json:"user"` <-- I don't want this
}
Harry Walter
@haswalt
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
@haswalt
Or is it perhaps possible to hook into the codegen to apply a default directive?
Li Guangsheng
@liguangsheng
hello
anyone?
novikov1337danil
@novikov1337danil
I'm looking for the ability to add any custom struct tags right in gql type defenition. How about 99designs/gqlgen#1173 ?
Mahendra Kumar
@mahendraHegde
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
@zadof
Hello, do you guys have any resources for using gqlgen with aws appsync?
Iko Uchiha
@ikouchiha47
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.
/companies/query
/employees/query

because I need to manage access for different user type

Iko Uchiha
@ikouchiha47
hi
in gqlgen yaml file, is there a way to have multiple resolver directory ?
Iko Uchiha
@ikouchiha47
hi
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
@ikouchiha47
is the question wrong?
Christopher Britz
@britztopher
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
@hetjagani
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
@iammadab
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
@iammadab
Stupid me, I literally didn't change the return value in my schema to fit the union.
Fixed!
Andrew Marine
@amarine7882

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
@amarine7882
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
@duckbrain
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
@anthonylobko
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
@anthonylobko
Nevermind, sorted it out
Andrew Ray
@andrewray_twitter
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
@andrewray_twitter
the tidy errors went away the second time I ran it, it seems to have generated successfully now
jongno-gu
@jongno-gu
Hi all. Is there any way to write "TYPE DETAILS" in playground docs?
jongno-gu
@jongno-gu

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
@IceeMC
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
@danyhenriquez:matrix.org
[m]

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/

Dany Henriquez
@danyhenriquez:matrix.org
[m]
Nevermind. The structure is clear now
Dany Henriquez
@danyhenriquez:matrix.org
[m]
/can anyone help? The auth example from the Docs is not working. The Forcontext returns nil and not the reference https://gqlgen.com/recipes/authentication/
Epo Jemba
@ejemba
Hi o/ newbie here ! I'm just playing with gqlgenc (client part). There is a models part of the config file .gqlgenc.yml that I can not understand how it works. I have the following message :
modelgen failed: unable to find type github.com/99designs/gqlgen/graphql.Float
my config file is http://ix.io/3uqf
Epo Jemba
@ejemba
ok fixed my problem myself
my project was not properly go mod initialised and after a go get github.com/99designs/gqlgen everything was fine