File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ You can pass context to a query via ``context``.
24
24
class Query (graphene .ObjectType ):
25
25
name = graphene.String()
26
26
27
- def resolve_name (self , info ):
27
+ def resolve_name (root , info ):
28
28
return info.context.get(' name' )
29
29
30
30
schema = graphene.Schema(Query)
@@ -33,18 +33,18 @@ You can pass context to a query via ``context``.
33
33
34
34
35
35
Variables
36
- _______
36
+ _________
37
37
38
38
You can pass variables to a query via ``variables ``.
39
39
40
40
41
41
.. code :: python
42
42
43
43
class Query (graphene .ObjectType ):
44
- user = graphene.Field(User)
44
+ user = graphene.Field(User, id = graphene.ID( required = True ) )
45
45
46
- def resolve_user (self , info ):
47
- return info.context.get( ' user ' )
46
+ def resolve_user (root , info , id ):
47
+ return get_user_by_id( id )
48
48
49
49
schema = graphene.Schema(Query)
50
50
result = schema.execute(
You can’t perform that action at this time.
0 commit comments