File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ Object types
2020.. autoclass :: graphene.Mutation
2121 :members:
2222
23+ .. _fields-mounted-types :
24+
2325Fields (Mounted Types)
2426----------------------
2527
Original file line number Diff line number Diff line change @@ -158,6 +158,22 @@ You can then execute the following query:
158158 }
159159 }
160160
161+ * Note:* There are several arguments to a field that are " reserved" by Graphene
162+ (see :ref:`fields- mounted- types` ).
163+ You can still define an argument that clashes with one of these fields by using
164+ the `` args`` parameter like so:
165+
166+ .. code:: python
167+
168+ from graphene import ObjectType, Field, String
169+
170+ class Query(ObjectType):
171+ answer = String(args = {' description' : String()})
172+
173+ def resolve_answer(parent, info, description):
174+ return description
175+
176+
161177Convenience Features of Graphene Resolvers
162178~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163179
Original file line number Diff line number Diff line change @@ -40,11 +40,12 @@ class Person(ObjectType):
4040 last_name = graphene.Field(String, description='Surname') # explicitly mounted as Field
4141
4242 args:
43- type (class for a graphene.UnmountedType): must be a class (not an instance) of an
43+ type (class for a graphene.UnmountedType): Must be a class (not an instance) of an
4444 unmounted graphene type (ex. scalar or object) which is used for the type of this
4545 field in the GraphQL schema.
46- args (optional, Dict[str, graphene.Argument]): arguments that can be input to the field.
47- Prefer to use **extra_args.
46+ args (optional, Dict[str, graphene.Argument]): Arguments that can be input to the field.
47+ Prefer to use ``**extra_args``, unless you use an argument name that clashes with one
48+ of the Field arguments presented here (see :ref:`example<ResolverParamGraphQLArguments>`).
4849 resolver (optional, Callable): A function to get the value for a Field from the parent
4950 value object. If not set, the default resolver method for the schema is used.
5051 source (optional, str): attribute name to resolve for this field from the parent value
You can’t perform that action at this time.
0 commit comments