Is there a way to auto deside when to call a resolver with a ` @goField(forceResolver: true)`
- 主要语言
- Go
- 星标
- 10.8k
- 派生
- 1.3k
- 平均合并
- 2 天 36 分钟
- 30 天内合并 PR
- 26
描述
### What happened?
If I set a ` @goField(forceResolver: true)` directive, it will be called anyway
### What did you expect?
We need a mechanism to automatically determine whether to invoke a resolver, instead of manually parsing fields to determine whether to execute.
like this:
```graphql
type Product {
productId: ID!
name: String!
extraFields: Any
}
type Project implements Node {
id: ID!
name: String!
products: [Product!] @goField(forceResolver: true, forceResolverIgnoredKeys: ["productId", "name"])
}
type Query {
project(id: ID!) Project!
}
```
the query will not call the `products` resolver in `Project`
```graphql
query {
project(id: "xxxxx") {
id
name
products {
productId # or name or both of them
}
}
}
```
the query will call resolver
```graphql
query {
project(id: "xxxxx") {
id
name
products {
productId
name
extraFields
}
}
}
```
### Minimal graphql.schema and models to reproduce
None
### versions
- `go run github.com/99designs/gqlgen version`? `v0.17.61`
- `go version`? `go version go1.23.4 linux/amd64`
贡献指南
评估
这个 Issue 还没有评估数据。