Merge branch 'master' into 2.0

This commit is contained in:
Syrus Akbary 2017-07-26 22:46:26 -07:00
commit e6b0cbb3bc

View File

@ -31,3 +31,30 @@ You can pass context to a query via ``context_value``.
schema = graphene.Schema(Query)
result = schema.execute('{ name }', context_value={'name': 'Syrus'})
Variables
_______
You can pass variables to a query via ``variable_values``.
.. code:: python
class Query(graphene.ObjectType):
user = graphene.Field(User)
def resolve_user(self, args, context, info):
return context.get('user')
schema = graphene.Schema(Query)
result = schema.execute(
'''query getUser($id: ID) {
user(id: $id) {
id
firstName
lastName
}
}''',
variable_values={'id': 12},
)