According to the documentation here, the second argument to a resolver function in the graphql-tools library is an object passed into the query
http://dev.apollodata.com/tools/graphql-tools/resolvers.html#Resolver-function-signature
However, if I run graphql-tools with a version of graphql >= 0.8.0, the "object" passed as the second argument is missing some object properties. For example, arg.constructor
and arg.hasOwnProperty
are undefined.
In the previous version, 0.7.2, both these statements would evaluate to true:
arg.consructor === Object
arg.hasOwnProperty === 'function'
Does anyone know what is actually getting passed as the second argument, or why these properties which usually exist on JS objects are undefined?
edit below:
I can get by this by doing something like this:
async resolverFuncForMutation(root, nonObjArgs, context) {
const args = Object.assign({}, nonObjArgs);
But I don't want to have to remember how to do that for every resolver function. Does anyone know how to if there's a way to configure that to happen in some kind of pre-resolution hook?