-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.8.1] Nullable union fields with resolvers generate methods expecting to return a pointer to an interface #594
Comments
Notably, |
This appears to be a regression as package test_gqlgen
import (
"context"
)
type Resolver struct{}
func (r *Resolver) Query() QueryResolver {
return &queryResolver{r}
}
type queryResolver struct{ *Resolver }
func (r *queryResolver) Bar(ctx context.Context) (Bar, error) {
panic("not implemented")
} |
Any plans when the new version with this bug fix will be released? |
0.8.2 is getting closer |
Awesome, thank you for all of your hard work! |
Folks, which one is the right behavior and why? Thanks! Between: A: and B: In my case of using type/interface as the return type in the schema, I always have B. When the return type is an union, I always get A. Is this expected? |
Expected Behaviour
A schema of:
With:
Will generate a resolver with signature:
Actual Behavior
A resolver with signature:
is generated where
*Bar
is a pointer to the Go interfaceBar
.I've worked around this for now by making the type not nullable in the GraphQL schema:
But this means the schema is not accurately expressing the fact that
null
can also be returned.This seems similar to #484
Minimal graphql.schema and models to reproduce
schema.graphql
gengql.yml
The text was updated successfully, but these errors were encountered: