Skip to content

Commit 3b1d13c

Browse files
committed
fix relay typing
1 parent 21765ab commit 3b1d13c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: ariadne/contrib/relay/objects.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import Awaitable
12
from inspect import iscoroutinefunction
23
from typing import Optional, cast
34

@@ -6,6 +7,7 @@
67
from graphql.type import GraphQLSchema
78

89
from ariadne import InterfaceType, ObjectType
10+
from ariadne.contrib.relay import RelayConnection
911
from ariadne.contrib.relay.arguments import (
1012
ConnectionArguments,
1113
ConnectionArgumentsTypeUnion,
@@ -36,11 +38,13 @@ def wrapper(obj, info, *args, **kwargs):
3638
if is_async_callable(resolver):
3739

3840
async def async_my_extension():
39-
relay_connection = await resolver(
41+
relay_connection = resolver(
4042
obj, info, connection_arguments, *args, **kwargs
4143
)
4244
if is_awaitable(relay_connection):
43-
relay_connection = await relay_connection
45+
relay_connection = await cast(
46+
Awaitable[RelayConnection], relay_connection
47+
)
4448
return {
4549
"totalCount": relay_connection.total,
4650
"edges": relay_connection.get_edges(),

0 commit comments

Comments
 (0)