graphql-middleware
graphql-middleware copied to clipboard
Wrong resolve argument in nested types
Hello !
I have the following resolvers, (schema created with makeExecutableSchema
)
const resolvers = {
Muation: {
viewerMutation: (_, args, context) => {
book: () => {
author: ({id}) => getAuthorForBook(id)
}
},
},
}
And I am trying to do something like this:
const logMiddleware = {
Muation: {
viewerMutation: async (resolve, parent, args, context, info) => {
book: () => {
author: ({id}) => {
console.log('request author for book:', id)
return resolve(root, {id}, context, info)
}
}
},
},
}
But I am getting an issue, the resolve
inside author
is not calling getAuthorForBook
.
I would have expected to find a resolver
argument on author
but nested types seem to behave differently from root types (under Mutation or Query)
Is this a normal behavior ?
I am having a similar issue
Hi @hassenc @theluk 👋 ,
Thank you for being so patient with this issue. I have the capacity to help you with the problem; I only need the reproduction CodeSandbox or something similar. This way, I can help you more quickly.