mirror of
https://github.com/graphql-python/graphene.git
synced 2025-09-21 19:32:33 +03:00
Change to root
This commit is contained in:
parent
6c70ae7eb2
commit
379ad8d9d4
|
@ -24,7 +24,7 @@ You can pass context to a query via ``context``.
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
name = graphene.String()
|
name = graphene.String()
|
||||||
|
|
||||||
def resolve_name(self, info):
|
def resolve_name(root, info):
|
||||||
return info.context.get('name')
|
return info.context.get('name')
|
||||||
|
|
||||||
schema = graphene.Schema(Query)
|
schema = graphene.Schema(Query)
|
||||||
|
@ -43,7 +43,7 @@ You can pass variables to a query via ``variables``.
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
user = graphene.Field(User, id=graphene.ID(required=True))
|
user = graphene.Field(User, id=graphene.ID(required=True))
|
||||||
|
|
||||||
def resolve_user(_, info, id):
|
def resolve_user(root, info, id):
|
||||||
return get_user_by_id(id)
|
return get_user_by_id(id)
|
||||||
|
|
||||||
schema = graphene.Schema(Query)
|
schema = graphene.Schema(Query)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user