You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our current type for Resolver is Callable[..., Any], catching any arguments and relasing anything.
This is because its currently impossible to tpe Callable that accepts *args or **kwagrs.
This issue is [known to MyPy authors](python/typing#264 but a the time of writing no solution is available.
EDIT
There are already some decent type definitions in graphql-core.
# Note: Contrary to the Javascript implementation of GraphQLFieldResolver,# the context is passed as part of the GraphQLResolveInfo and any arguments# are passed individually as keyword arguments.GraphQLFieldResolverWithoutArgs=Callable[[Any, GraphQLResolveInfo], Any]
# Unfortunately there is currently no syntax to indicate optional or keyword# arguments in Python, so we also allow any other Callable as a workaround:GraphQLFieldResolver=Callable[..., Any]
# Note: Contrary to the Javascript implementation of GraphQLTypeResolver,# the context is passed as part of the GraphQLResolveInfo:GraphQLTypeResolver=Callable[
[Any, GraphQLResolveInfo, "GraphQLAbstractType"],
AwaitableOrValue[Optional[Union["GraphQLObjectType", str]]],
]
However, GraphQLFieldResolver could also be more accurate.
Should ariadne import types from graphql-core or use its own definitions?
Anyway, the Resolver type definition could be rewritten to:
Our current type for
Resolver
isCallable[..., Any]
, catching any arguments and relasing anything.This is because its currently impossible to tpe
Callable
that accepts*args
or**kwagrs
.This issue is [known to MyPy authors](python/typing#264 but a the time of writing no solution is available.
This is related to #79
The text was updated successfully, but these errors were encountered: