graphql-go / graphql-go/graphql
Extension ResolveFieldFinishFunc executed before resolver runs value function
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 845
- PR merge metrics
- No merged PRs in 30d
Description
When using an extension with a schema which has a resolver that returns a function value, e.g.
```go
func(p graphql.ResolveParams) (interface{}, error) {
return func() (interface{}, error) {
return "hello", nil
}, nil
}
```
the `ResolveFieldFinishFunc` (as registered by the `ResolveFieldDidStart` method on the extension) is called before the function value is executed. If I'm reading the source correctly below for `resolveField`, `resolveFieldFinishFn` is called immediately after the `resolveFn`, but before `completeValueCatchingError` actually evaluates the resolver value if it is a function.
https://github.com/graphql-go/graphql/blob/bed865f0458679ed5309c2cc4bfa82a2f84d8b5f/executor.go#L657-L663
Is there a reason for this? Since the `Extension` interface was created in part to support tracing use cases as per https://github.com/graphql-go/graphql/pull/448, that we would want to only run the `ResolveFieldFinishFunc` after the resolver value is fully evaluated.
Contributor guide
Assessment
This issue has not been assessed yet.