diff --git a/graphene/types/schema.py b/graphene/types/schema.py index 5eb59e66..55f0bf93 100644 --- a/graphene/types/schema.py +++ b/graphene/types/schema.py @@ -80,7 +80,7 @@ def is_type_of_from_possible_types(possible_types, root, _info): # We use this resolver for subscriptions -def identity_resolve(root, info): +def identity_resolve(root, info, **arguments): return root diff --git a/graphene/types/tests/test_subscribe_async.py b/graphene/types/tests/test_subscribe_async.py index 6f7ce4c6..9b7a1f13 100644 --- a/graphene/types/tests/test_subscribe_async.py +++ b/graphene/types/tests/test_subscribe_async.py @@ -54,3 +54,27 @@ async def test_subscription_fails_when_query_is_not_valid(): assert "Anonymous Subscription must select only one top level field." in str( result.errors[0] ) + + +@mark.asyncio +async def test_subscription_with_args(): + class Query(ObjectType): + hello = String() + + class Subscription(ObjectType): + count_upwards = Field(Int, limit=Int(required=True)) + + async def subscribe_count_upwards(root, info, limit): + count = 0 + while count < limit: + count += 1 + yield count + + schema = Schema(query=Query, subscription=Subscription) + + subscription = "subscription { countUpwards(limit: 5) }" + result = await schema.subscribe(subscription) + count = 0 + async for item in result: + count = item.data["countUpwards"] + assert count == 5