What is a resolver in Ariadne
mainIn Ariadne, a resolver is any Python callable (synchronous or asynchronous) that accepts two positional arguments:
obj: The value returned by the parent resolver. For root resolvers (onQuery,Mutation, orSubscription), this isNoneif the server doesn't explicitly define a value.info: An instance ofGraphQLResolveInfo. The most commonly used attribute on this object isinfo.context, which contains application-specific data like authentication state or HTTP requests.
Resolvers can be standard functions or classes implementing __call__.
def example_resolver(obj: Any, info: GraphQLResolveInfo):
return obj.do_something()
class FormResolver:
def __call__(self, obj: Any, info: GraphQLResolveInfo, **data):
...