From 9be3922ad59db1a7bc7a973fdc90b22f735c1882 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 1 Apr 2020 16:11:09 +0100 Subject: [PATCH] Add note about the use of `args` Closes #1037 --- docs/types/objecttypes.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/types/objecttypes.rst b/docs/types/objecttypes.rst index 984acbf0..721090ac 100644 --- a/docs/types/objecttypes.rst +++ b/docs/types/objecttypes.rst @@ -158,6 +158,22 @@ You can then execute the following query: } } +*Note:* There are several arguments to a field that are "reserved" by Graphene +(you can see the full list here: https://docs.graphene-python.org/en/latest/api/#fields-mounted-types). +You can still define an argument that clashes with one of these fields by using +the ``args`` paramter like so: + +.. code:: python + + from graphene import ObjectType, Field, String + + class Query(ObjectType): + answer = graphene.Int(args={'description': graphene.Int()}) + + def resolve_answer(parent, info, description): + return description + + Convenience Features of Graphene Resolvers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~