How can I register a default resolver for a Type? #1201
Unanswered
steve-marmalade
asked this question in
Q&A
Replies: 2 comments
-
|
@steve-marmalade I'm looking into doing something similar. Have you figured out a workaround? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@steve-marmalade I'm wondering whether you considered loading of products in the @query.field("topProducts")
async def resolve_top_products(_, info):
top_product_ids = await fetch_top_product_ids()
return [load_product(id_) for id_ in top_product_ids]Assuming |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Consider the situation where I have a product type:
and let's say I have an API of the form:
along with many different ways to get lists of product ids. My desired outcome is to write my "list" resolvers such they return lists of product ids:
And so here comes the feature request:
Instead of writing something like the following for each product field:
I want to register a custom "special default resolver" (docs below) :
Here are the Ariadne docs for case conversion:
So basically, I need a way to enhance this "special resolver" on a per-type basis. This would save me a lot of boilerplate.
Beta Was this translation helpful? Give feedback.
All reactions