Closed
Description
In #232 , I suggested that @BatchMapping
should support @Argument
, because user will define arguments on field, no matter whether the field is fetched by DataLoader or 'n+1' way. Furthermore, user will always want to get information about field, such as field definition or directives info.
Hence, I think BatchLoaderHandlerMethod
should support custom argument resolve strategy which resolving method parameters into argument values, like #295 . BatchMappingDataFetcher
should use dataLoader.load(env.getSource(), env);
(code like below), and argument resolve strategy and batch handler method will get all the information about the fetched field.
static class BatchMappingDataFetcher implements DataFetcher<Object> {
......
@Override
public Object get(DataFetchingEnvironment env) {
DataLoader<?, ?> dataLoader = env.getDataLoaderRegistry().getDataLoader(this.dataLoaderKey);
if (dataLoader == null) {
throw new IllegalStateException("No DataLoader for key '" + this.dataLoaderKey + "'");
}
// pass DataFetchingEnvironment to DataLoader and other component
return dataLoader.load(env.getSource(), env);
}
}
Metadata
Metadata
Assignees
Labels
No labels