From 06757f10c6cbfb3885531b02a2c93e94491380a5 Mon Sep 17 00:00:00 2001 From: Kuan Date: Thu, 13 Apr 2017 10:32:49 -0700 Subject: [PATCH] Update basic schema with arguments --- docs/quickstart.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 09dddb6f..44a686cf 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -30,17 +30,17 @@ server with an associated set of resolve methods that know how to fetch data. We are going to create a very simple schema, with a ``Query`` with only -one field: ``hello``. And when we query it, it should return ``"World"``. +one field: ``hello`` and an input name. And when we query it, it should return ``"Hello {name}"``. .. code:: python import graphene class Query(graphene.ObjectType): - hello = graphene.String() + hello = graphene.String(name=graphene.Argument(graphene.String, default_value="stranger")) def resolve_hello(self, args, context, info): - return 'World' + return 'Hello ' + args['name'] schema = graphene.Schema(query=Query) @@ -52,6 +52,6 @@ Then we can start querying our schema: .. code:: python result = schema.execute('{ hello }') - print result.data['hello'] # "World" + print result.data['hello'] # "Hello stranger" Congrats! You got your first graphene schema working!