Hi all, how can I override a resolver from the gen...
# prisma-whats-new
m
Hi all, how can I override a resolver from the generated folder?
n
It's not entirely clear what you mean with this question. Can you elaborate?
m
I have created a custom resolver like so:
Copy code
export const Timeline = {
  posts: async (parent, args, ctx: Context, info) => {
    console.log("Parent: " + JSON.stringify(parent));
    console.log("args: " + JSON.stringify(args));
    const { after, id } = args;
   ..... fetch the posts according to a custom rule .....
};
However, printing the
parent
argument shows that the timeline query has already queried all posts. via the ` posts(....)`prisma resolver defined in
generated/prisma.graphql
.
However, I would like for prisma to call my resolver INSTEAD of the prisma resolver, not after. Is this possible?
n
A quick note on terminology, you have written a resolver. Calling that a custom resolver is like calling a javascript function a custom function.
m
Ok thanks. With custom I meant that I have written a resovler on top of the default resolver binding that prisma supplies. Do you understand my situation thought?
n
On to your question. It's not possible to answer the question with the information you presented so far. More information about your entire resolver setup is needed. Also, this question seems to be very closely related to your previous message https://graphcool.slack.com/archives/C0MQJ62NL/p1522765177000616. My hunch is that your questions stem from a misunderstanding/missing knowledge about the resolver execution in a GraphQL server, but it's hard to tell if that's the problem at the moment. My suggestion is that you start a new discussion about this in the Forum, to have a meaningful conversation about your resolver setup.
m
OK thanks, I started a forum post. Your hunch should be right, im still new to the resolver concept and graphql 🙂