You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/types/objecttypes.rst
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -52,16 +52,16 @@ Resolvers are lazily executed, so if a field is not included in a query, its res
52
52
Each field on an *ObjectType* in Graphene should have a corresponding resolver method to fetch data. This resolver method should match the field name. For example, in the ``Person`` type above, the ``full_name`` field is resolved by the method ``resolve_full_name``.
53
53
54
54
Each resolver method takes the parameters:
55
-
* :ref:`ResolverRootArgument` for the value object use to resolve most fields
56
-
* :ref:`ResolverInfoArgument` for query and schema meta information and per-request context
57
-
* :ref:`ResolverGraphQLArguments` as defined on the **Field**.
55
+
* :ref:`ResolverParamParent` for the value object use to resolve most fields
56
+
* :ref:`ResolverParamInfo` for query and schema meta information and per-request context
57
+
* :ref:`ResolverParamGraphQLArguments` as defined on the **Field**.
58
58
59
59
.. _ResolverArguments:
60
60
61
61
Resolver Parameters
62
62
~~~~~~~~~~~~~~~~~~~
63
63
64
-
.. _ResolverRootArgument:
64
+
.. _ResolverParamParent:
65
65
66
66
Parent Value Object (*parent*)
67
67
******************************
@@ -110,14 +110,14 @@ Then we go through the following steps to resolve this query:
110
110
* This value objectis then used as``parent``while calling ``Person.resolve_full_name`` to resolve the scalar String value "Luke Skywalker".
111
111
* The scalar value is serialized and sent back in the query response.
112
112
113
-
Each resolver returns the next :ref:`ResolverRootArgument` to be used in executing the following resolver in the chain. If the Field is a Scalar type, that value will be serialized and sent in the **Response**. Otherwise, while resolving Compound types like *ObjectType*, the value be passed forward as the next :ref:`ResolverRootArgument`.
113
+
Each resolver returns the next :ref:`ResolverParamParent` to be used in executing the following resolver in the chain. If the Field is a Scalar type, that value will be serialized and sent in the **Response**. Otherwise, while resolving Compound types like *ObjectType*, the value be passed forward as the next :ref:`ResolverParamParent`.
114
114
115
115
Naming convention
116
116
^^^^^^^^^^^^^^^^^
117
117
118
-
This :ref:`ResolverRootArgument`is sometimes named ``obj``, ``parent``, or``source``in other GraphQL documentation. It can also be named after the value object being resolved (ex. ``root``for a root Query or Mutation, and``person``for a Person value object). Sometimes this argument will be named ``self``in Graphene code, but this can be misleading due to :ref:`ResolverImplicitStaticMethod`while executing queries in Graphene.
118
+
This :ref:`ResolverParamParent`is sometimes named ``obj``, ``parent``, or``source``in other GraphQL documentation. It can also be named after the value object being resolved (ex. ``root``for a root Query or Mutation, and``person``for a Person value object). Sometimes this argument will be named ``self``in Graphene code, but this can be misleading due to :ref:`ResolverImplicitStaticMethod`while executing queries in Graphene.
119
119
120
-
.. _ResolverInfoArgument:
120
+
.. _ResolverParamInfo:
121
121
122
122
GraphQL Execution Info (*info*)
123
123
*******************************
@@ -129,7 +129,7 @@ The second parameter provides two things:
129
129
130
130
Only context will be required for most applications. See :ref:`SchemaExecuteContext`for more information about setting context.
131
131
132
-
.. _ResolverGraphQLArguments:
132
+
.. _ResolverParamGraphQLArguments:
133
133
134
134
GraphQL Arguments (*\*\*kwargs*)
135
135
********************************
@@ -166,7 +166,7 @@ Convenience Features of Graphene Resolvers
166
166
Implicit staticmethod
167
167
*********************
168
168
169
-
One surprising feature of Graphene is that all resolver methods are treated implicitly as staticmethods. This means that, unlike other methods in Python, the first argument of a resolver is*never*``self``while it is being executed by Graphene. Instead, the first argument is always :ref:`ResolverRootArgument`. In practice, this is very convenient as, in GraphQL, we are almost always more concerned with the using the parent value object to resolve queries than attributes on the Python object itself.
169
+
One surprising feature of Graphene is that all resolver methods are treated implicitly as staticmethods. This means that, unlike other methods in Python, the first argument of a resolver is*never*``self``while it is being executed by Graphene. Instead, the first argument is always :ref:`ResolverParamParent`. In practice, this is very convenient as, in GraphQL, we are almost always more concerned with the using the parent value object to resolve queries than attributes on the Python object itself.
170
170
171
171
The two resolvers in this example are effectively the same.
172
172
@@ -204,7 +204,7 @@ Default Resolver
204
204
205
205
If a resolver method isnot defined for a **Field** attribute on our *ObjectType*, Graphene supplies a default resolver.
206
206
207
-
If the :ref:`ResolverRootArgument`is a dictionary, the resolver will look for a dictionary key matching the field name. Otherwise, the resolver will get the attribute from the parent value object matching the field name.
207
+
If the :ref:`ResolverParamParent`is a dictionary, the resolver will look for a dictionary key matching the field name. Otherwise, the resolver will get the attribute from the parent value object matching the field name.
0 commit comments