I'm using apollo-server and testing using GraphiQL in my browser. I set up my resolvers based on Apollo's GitHunt-API example, but the resolver on the field "review.extraStuff" never gets called.
Resolver
const rootResolvers = {
review(root, args, context) {
console.log('resolving review');
return {'HasErrors': true}
}
}
const extraStuff = (root, args, context) => {
console.log('resolving extraStuff');
return "yes";
}
rootResolvers.review.extraStuff = extraStuff;
export default {
RootQuery: rootResolvers
};
Schema
const Review = `
type Review {
HasErrors: Boolean
extraStuff: String
}
`
const RootQuery = `
type RootQuery {
review(id: String!): Review
}
`;
const SchemaDefinition = `
schema {
query: RootQuery
}
`;
Query result from GraphiQL
Additional Info
I know that Apollo is aware of my extraStuff resolver because if I set "requireResolversForNonScalar" to true, I don't get a message telling me extraStuff is missing a resolve function. I've added logging to both the schema and the apolloExpress middleware and learned nothing.