I'm using graphql-tools
and am testing a schema where both parent and child receive an argument.
{
parentWithArg(a: "test") {
childWithArg(b: "test")
}
}
When the child resolver runs, I'm confused because the first argument contains args
, which does not match the spec. The obj
argument appears to be completely absent?
const resolvers = {
Query: {
parentWithArg(obj, args, ctx) {
console.log('parentWithArg obj:', obj); // `{}` as expected
return {
childWithArg(obj, args, ctx) {
console.log('childWithArg obj:', obj); // `{ b: 'test' }`
return args.b; // null
}
};
},
},
};
Here is the example on Apollo Launchpad: https://launchpad.graphql.com/p08j03j8r0