No validation error when resolver output is nullable although in the schema the output is specified as non-nullable
- Dominant language
- Go
- Stars
- 10.8k
- Forks
- 1.3k
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 26
Description
### What happened?
While trying to solve a coworker's problem who was getting this error:
```
{
"errors": [
{
"message": "must not be null",
"path": [
"applications"
]
}
],
"data": null
}
```
We realized that the schema output does not match the resolver output, but he did not get any
errors and we were able to run everything except the vague error in the response.
### What did you expect?
To get the error identifying that the resolver output does not match the written schema output in validation.
Something like this:
validation failed: ... cannot use &(queryResolver literal) (value of type *queryResolver) as QueryResolver value in return statement: wrong type for method Applicantions
### Minimal graphql.schema and models to reproduce
#### Schema:
```
type Application {
id: ID!
...
}
type QueryApplicationsOutput {
applications: [ApplicationOutput!]
...
}
type ApplicationOutput {
id: ID!
...
}
type Query {
applications(limit: Int, offset: Int): QueryApplicationsOutput!
}
```
#### Model:
```
type Application struct {
ID uuid.UUID `json:"id"`
...
}
type QueryApplicationsOutput struct {
Applications []*ApplicationOutput `json:"applications"`
...
}
type ApplicationOutput struct {
ID uuid.UUID `json:"id"`
...
}
```
#### Resolver:
```
func (r *queryResolver) Applications(ctx context.Context, limit *int, offset *int) (*QueryApplicationsOutput, error) {
return nil, nil
}
```
### versions
- `gqlgen version`? v0.11.3
- `go version`? 1.13
- dep or go modules? go modules
Contributor guide
Assessment
This issue has not been assessed yet.