Use case for resolve and resolveField outside of root query? #913
Unanswered
abdullahseba
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the use case for having
resolve
andresolveField
at the type level? If the rootquery
does not have a resolver, none of the resolvers further down get executed. I learned from #721 (comment), that if the root query resolver returns anything other thannull
, the resolvers further down get executed. However, for a multi-level query, resolvers that returntrue
, cause an error. Take the following query:Root query field:
ObjectRecordConnection type:
ObjectRecord Edge type:
ObjectRecord type:
Result:
Without
ObjectRecordConnection
returningedges
andObjectRecordEdge
returningnode
arrays, the description resolver does not run. With the code above, the description resolver overwrites anything returned by the previous resolver in thenode
array.Having to return part of the query in each resolver seems long-winded for multi-level queries, and I was curious what use cases there would be for doing this. I may well be missing something obvious, and it's a case 'just because you can, doesn't mean you should'. To be clear, I'm just experimenting and trying to find the best way to structure my project.
Thank you for the great library!
Beta Was this translation helpful? Give feedback.
All reactions