Is there a way to batch/combine field resolvers? #1214
-
First I have a background question: are field resolvers how type-graphql implements what Apollo Server calls resolver chains? This seems to be the case, but the example is somewhat trivial (calculating the Assuming all that is correct, here is my situation. I have a schema that looks something like: type Query {
getJobs: [Job!]
}
type Job {
id: ID!
queue: String!
command: String!
cwd: String!
resources: String!
} The resolvers get the data from a command line API that has two limits: commands per minute, and payload (in bytes) per minute. Right now, the So what I could do is create a field resolver for every field. This would allow me to only fetch data I actually need (i.e. What I really need is some way to know which particular fields are requested, so I can only run the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's a standard GraphQL concept, not an Apollo feature.
You need something like #10, to know before fetching the data which fields are requested. |
Beta Was this translation helpful? Give feedback.
It's a standard GraphQL concept, not an Apollo feature.
You need something like #10, to know before fetching the data which fields are requested.
But have in mind that it's dangerous because other field resolvers now can't expect all the fields to be present in
@Root()
.