Skip to content

Commit 08c86f3

Browse files
authored
Merge pull request #845 from nive/master
quickstart example improvement
2 parents 37a6c01 + 85e6c3d commit 08c86f3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/quickstart.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,18 @@ server with an associated set of resolve methods that know how to fetch
3030
data.
3131

3232
We are going to create a very simple schema, with a ``Query`` with only
33-
one field: ``hello`` and an input name. And when we query it, it should return ``"Hello {name}"``.
33+
one field: ``hello`` and an input name. And when we query it, it should return ``"Hello
34+
{argument}"``.
3435

3536
.. code:: python
3637
3738
import graphene
3839
3940
class Query(graphene.ObjectType):
40-
hello = graphene.String(name=graphene.String(default_value="stranger"))
41+
hello = graphene.String(argument=graphene.String(default_value="stranger"))
4142
42-
def resolve_hello(self, info, name):
43-
return 'Hello ' + name
43+
def resolve_hello(self, info, argument):
44+
return 'Hello ' + argument
4445
4546
schema = graphene.Schema(query=Query)
4647
@@ -54,4 +55,8 @@ Then we can start querying our schema:
5455
result = schema.execute('{ hello }')
5556
print(result.data['hello']) # "Hello stranger"
5657
58+
# or passing the argument in the query
59+
result = schema.execute('{ hello (argument: "graph") }')
60+
print(result.data['hello']) # "Hello graph"
61+
5762
Congrats! You got your first graphene schema working!

0 commit comments

Comments
 (0)