mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-10 19:56:45 +03:00
Fixed examples, make root object explicit inside resolvers and… (#1159)
This commit is contained in:
parent
60a9609b9a
commit
f9efe15973
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user