gqlgen
gqlgen copied to clipboard
BUG: Panic when trying to return a struct that implements the desired interface
What happened?
func (r *queryResolver) QueryMyInterface(ctx context.Context, filter *model.MyInterfaceFilter, order *model.MyInterfaceOrder, first *int, offset *int) ([]model.MyInterface, error) {
var ifaces []model.MyInterface
ifaces = append(ifaces, Test{.....})
// Test implements the `model.MyInterface`
......
.....
return ifaces --> That panics with error `unexpected type Test` when we call the `QueryMyInterface` operation
What did you expect?
I expect no errors.
Minimal graphql.schema and models to reproduce
versions
-
go run github.com/99designs/gqlgen version? v0.17.16 -
go version? go version go1.18.1 linux/amd64
/cc @vektah @neelance
Am I doing something wrong here?