Skip to content

Commit e3663d4

Browse files
authored
Merge pull request #452 from khankuan/patch-1
Update basic schema with arguments
2 parents b8323ed + 06757f1 commit e3663d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/quickstart.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ 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 when we query it, it should return ``"World"``.
33+
one field: ``hello`` and an input name. And when we query it, it should return ``"Hello {name}"``.
3434

3535
.. code:: python
3636
3737
import graphene
3838
3939
class Query(graphene.ObjectType):
40-
hello = graphene.String()
40+
hello = graphene.String(name=graphene.Argument(graphene.String, default_value="stranger"))
4141
4242
def resolve_hello(self, args, context, info):
43-
return 'World'
43+
return 'Hello ' + args['name']
4444
4545
schema = graphene.Schema(query=Query)
4646
@@ -52,6 +52,6 @@ Then we can start querying our schema:
5252
.. code:: python
5353
5454
result = schema.execute('{ hello }')
55-
print result.data['hello'] # "World"
55+
print result.data['hello'] # "Hello stranger"
5656
5757
Congrats! You got your first graphene schema working!

0 commit comments

Comments
 (0)