I am using those GraphQL Java dependencies:
| +- com.graphql-java:graphql-java:jar:17.3:compile
| | +- com.graphql-java:java-dataloader:jar:3.1.0:compile
With this schema:
schema {
query: Query
}
type Query {
users: UsersNamespace
}
type UsersNamespace {
userByPhone(phone: String!): User!
}
type User {
id: String!
photoId: String
}
Using this query
{
user1: userByPhone(phone: "375290201111") {
id
photoId
}
user2: userByPhone(phone: "375290202222") {
id
photoId
}
}
Assume I have a separate dataFetcehr for the User itself and the photoId which I get from a different source.
I want to pass the phone argument (or even the alias of the parent user) down to the photoId data fetcher.
I can not save the information on the GraphQlContext since the resolution is not performed "Depth-first", meaning the data fetchers will be called in this order:
Usersdata fetcher foruser1Usersdata fetcher foruser2photoIddata fetcher foruser1photoIddata fetcher foruser2
So anything I will save for user1 will be overridden by user data-fetcher.
How can I pass down arguments / information to child resolvers under the same alias?
*Note: photoId is always resolved only within a User