-
Notifications
You must be signed in to change notification settings - Fork 96
Description
I am trying to leverage your package to make a schema builder. To do this, I scan my package for a certain class annotation, and construct a GraphQLObjectType
from any of those classes found.
I'm having a problem with the MethodDataFetcher on methods using this approach (the GraphQLDataFetcher
annotation with a separate data fetching class works). When the MethodDataFetcher tries to resolve the field, environment.getSource()
is null
and the fetcher returns null
. This only appears to be a problem for fields defined on the QueryRoot.
A root fields node may be defined like this:
class ModelRootQueries {
public Model modelById(@GraphQLName("id") String id) {
// never invoked
return ModelService.get(id);
}
}
I am constructing my QueryRoot like so:
GraphQLObjectType node = GraphQLAnnotations.newObject(ModelRootQueries.class);
root.fields(node.getFieldDefinitions();
...
GraphQLSchema schema = newSchema.query(root).build();
In this case, the body of the method is never called, and data
ends up being null
.
I'd appreciate some insight into whether I'm wiring it incorrectly, or if there's a problem with the MethodDataFetcher's implementation.
Thanks,
Alex