Fixed examples, make root object explicit inside resolvers and… (#1159)

This commit is contained in:
Oleh Kuchuk 2020-03-15 20:52:56 +02:00 committed by GitHub
parent 60a9609b9a
commit f9efe15973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View File

@ -17,7 +17,7 @@ class Address(graphene.ObjectType):
class Query(graphene.ObjectType):
address = graphene.Field(Address, geo=GeoInput(required=True))
def resolve_address(self, info, geo):
def resolve_address(root, info, geo):
return Address(latlng=geo.latlng)
@ -27,7 +27,7 @@ class CreateAddress(graphene.Mutation):
Output = Address
def mutate(self, info, geo):
def mutate(root, info, geo):
return Address(latlng=geo.latlng)

View File

@ -9,7 +9,7 @@ class User(graphene.ObjectType):
class Query(graphene.ObjectType):
me = graphene.Field(User)
def resolve_me(self, info):
def resolve_me(root, info):
return info.context["user"]

View File

@ -11,7 +11,7 @@ class Query(graphene.ObjectType):
patron = graphene.Field(Patron)
def resolve_patron(self, info):
def resolve_patron(root, info):
return Patron(id=1, name="Syrus", age=27)

View File

@ -39,13 +39,13 @@ class Query(graphene.ObjectType):
human = graphene.Field(Human, id=graphene.String())
droid = graphene.Field(Droid, id=graphene.String())
def resolve_hero(self, info, episode=None):
def resolve_hero(root, info, episode=None):
return get_hero(episode)
def resolve_human(self, info, id):
def resolve_human(root, info, id):
return get_human(id)
def resolve_droid(self, info, id):
def resolve_droid(root, info, id):
return get_droid(id)

View File

@ -64,10 +64,10 @@ class Query(graphene.ObjectType):
empire = graphene.Field(Faction)
node = relay.Node.Field()
def resolve_rebels(self, info):
def resolve_rebels(root, info):
return get_rebels()
def resolve_empire(self, info):
def resolve_empire(root, info):
return get_empire()