You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initial work refactoring class Meta to class arguments.
Initial work refactoring class Meta to class arguments.
Refactoring firehose imports to explicit imports.
More blackening of example code.
More refactoring of `class Meta` into class arguments.
Copy file name to clipboardExpand all lines: docs/execution/execute.rst
+20-18
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@ For executing a query a schema, you can directly call the ``execute`` method on
7
7
8
8
.. code:: python
9
9
10
-
schema =graphene.Schema(...)
11
-
result = schema.execute('{ name }')
10
+
schema = Schema(...)
11
+
result = schema.execute("{ name }")
12
12
13
13
``result`` represents the result of execution. ``result.data`` is the result of executing the query, ``result.errors`` is ``None`` if no errors occurred, and is a non-empty list if an error occurred.
14
14
@@ -21,14 +21,15 @@ You can pass context to a query via ``context``.
21
21
22
22
.. code:: python
23
23
24
-
classQuery(graphene.ObjectType):
25
-
name =graphene.String()
24
+
classQuery(ObjectType):
25
+
name = String()
26
26
27
27
defresolve_name(root, info):
28
-
return info.context.get('name')
28
+
return info.context.get("name")
29
29
30
-
schema = graphene.Schema(Query)
31
-
result = schema.execute('{ name }', context={'name': 'Syrus'})
30
+
31
+
schema = Schema(Query)
32
+
result = schema.execute("{ name }", context={"name": "Syrus"})
32
33
33
34
34
35
@@ -40,22 +41,23 @@ You can pass variables to a query via ``variables``.
40
41
41
42
.. code:: python
42
43
43
-
classQuery(graphene.ObjectType):
44
-
user =graphene.Field(User, id=graphene.ID(required=True))
0 commit comments