New question - where do I find docs for the argume...
# prisma-whats-new
w
New question - where do I find docs for the arguments that the resolver passes us?
async addToCart(parent, args, ctx, info) {
n
prepare yourself for some blog articles! 😄 one moment
w
😄 thank you
m
A resolver function takes four arguments (in that order): parent: The result of the previous resolver call (more info). args: The arguments of the resolver’s field. context: A custom object each resolver can read from/write to. info: That’s what we’ll discuss in this article.
💡 1
n
Thanks Max 🙂 @wesbos you can scroll directly to the “Anatomy of a resolver function” section
💯 3
w
beautiful - thank you will read into this
so I can pass my mutations and update the info variable instead of having to re-write the query in my resolver? Seems like it just takes the query the client sent it
n
yes, in most cases. there are more complex cases where you can't just pass in the
info
object into your resolver right away
👍 1
w
great! That’s one less query I have to write
thank you all - this post is a wealth of info
💚 3
n
note that the mechanism of resolvers and
info
is one of the subtle superpowers of GraphQL 🙂
you just slap in an
info
object and the resolver hierarchy handles the rest
m
agreed 🙂 it's so helpful. at one point I was hand writing some queries but it was painful and only handled a small set of use cases. The strength of GraphQL is that it is so powerful but it's also a downside as the user can ask for almost anything
and you have to handle it
💯 1
n
Good point. I'd say it's a new tool that needs to be used in a new way to reach its highest potential.
m
that's where
info
came in 🙂
and
prisma
💚
prisma 1