-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Description
Is it possible to use resolve_
method on nested objects like in following updated aiohttp example code?
import random
import asyncio
import graphene
class Query(graphene.ObjectType):
base = graphene.String()
class RandomType(graphene.ObjectType):
seconds = graphene.Int()
random_int = graphene.Int()
async def resolve_random_int(_, __):
return random.randint(0, 500)
class Subscription(graphene.ObjectType):
random_int = graphene.Field(RandomType)
async def resolve_random_int(root, info):
i = 0
while True:
yield RandomType(seconds=i)
await asyncio.sleep(1.)
i += 1
schema = graphene.Schema(query=Query, subscription=Subscription)
I'm getting following error message
{
"id": 26,
"type": "data",
"payload": {
"data": {
"random_int": null
},
"errors": [
{
"message": "int() argument must be a string, a bytes-like object or a number, not 'AnonymousObservable'"
}
]}}
Metadata
Metadata
Assignees
Labels
No labels