Accessing Child Field Arguments in Parent Data Fetcher #2222
Closed
divyanshubhati
started this conversation in
General
Replies: 1 comment
-
|
Duplicate : #1455 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my project, I have the following GraphQL schema:
I have an internal service that takes a showId and a review count (param) and returns the full Show object — including title, author, and the list of reviews.
My goal is to call this internal service once and populate all fields of the Show object, including the reviews, in a single fetch.
Initially, I tried accessing the param argument from the reviews field inside the Shows data fetcher using @InputArgument("param"), but realized that field-level arguments (like param on reviews) are not accessible from the parent resolver.
Is there a recommended workaround for this scenario in DGS? Ideally, I’d like to avoid multiple service calls and populate all fields efficiently. Any suggestions on how to structure the fetchers or use data loaders to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions