Closed hboylan closed 2 weeks ago
Yeah, that error is misleading! If you upgrade to v0.17.54 you can get a more reasonable stacktrace that points you to what the actual problem is.
Either way, you just need to implement your resolvers. If you edit graph/schema.resolvers.go
and implement the Todos:
// Todos is the resolver for the todos field.
func (r *queryResolver) Todos(ctx context.Context) ([]*model.Todo, error) {
todo := &model.Todo{
ID: "Something",
Text: "Do something",
Done: false,
User: &model.User{
ID: "one",
Name: "Bob",
},
}
return []*model.Todo{todo}, nil
}
Then your query actually works!
@dericcain @wshirey @chiijlaw You all gave thumbs up, so I assume you are either encountering the same problem or working together. Does this explanation help you all?
If you upgrade to v0.17.54 you can get a more reasonable stacktrace that points you to what the actual problem is.
Sorry about the hasty example here. The upgrade to v0.17.54 fixed the error in our actual project. Thank you!
What happened?
Trying to use the
@entityResolver(multi: true)
directive. The multi entity resolver is generated properly, but any requests to it yield a directive error.What did you expect?
Should be able to resolve multi entity.
Minimal graphql.schema and models to reproduce
https://github.com/hboylan/gqlgen-multi-entity-resolver
operation:
response:
versions
go run github.com/99designs/gqlgen version
?go version
?