You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a GraphQL schema that makes a lot of use of interfaces and relations, where my internal models don't quite match up with the GQL representation so I need GQLGen to generate these models. For that I used the @goModel(forceGenerate: true) directive on my model which works fine.
However, the schema also has a lot of relations that need to be returned in field resolvers which is where I would want to use the @goField(forceResolver: true) directive.
If I combine the two it seems no model is generated, and GQLGen errors out with:
mergingtypesystemsfailed: unabletobindtointerface: github.com/Dan6erbond/gqlgen-force-directives-playground/models.PrivateTododoesnotsatisfytheinterfacegithub.com/Dan6erbond/gqlgen-force-directives-playground/graph/model.Todoexitstatus1graph\resolver.go:1: running "go": exit status 1
What did you expect?
I expected GQLGen to generate the models and the resolvers.
Without the @goField directive it works fine, I get these models:
The current workaround I have is configuring the models and resolvers via the gqlgen.yml file, but with how large our API is, it's getting bloated and I'd prefer to make use of directives.
What happened?
I am building a GraphQL schema that makes a lot of use of interfaces and relations, where my internal models don't quite match up with the GQL representation so I need GQLGen to generate these models. For that I used the
@goModel(forceGenerate: true)
directive on my model which works fine.However, the schema also has a lot of relations that need to be returned in field resolvers which is where I would want to use the
@goField(forceResolver: true)
directive.If I combine the two it seems no model is generated, and GQLGen errors out with:
What did you expect?
I expected GQLGen to generate the models and the resolvers.
Without the
@goField
directive it works fine, I get these models:The current workaround I have is configuring the models and resolvers via the
gqlgen.yml
file, but with how large our API is, it's getting bloated and I'd prefer to make use of directives.Minimal graphql.schema and models to reproduce
Schema:
Models:
I have a sandbox repo here that showcases the issue on
main
and shows the workaround onfeature/without-force-resolver
.versions
go run github.com/99designs/gqlgen version
: v0.17.49go version
: go version go1.22.3 windows/amd64The text was updated successfully, but these errors were encountered: