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
@@ -135,33 +135,32 @@ Every data fetcher is passed a ``graphql.schema.DataFetchingEnvironment`` object
135
135
and what arguments have been provided. Here are some of the more interesting parts of ``DataFetchingEnvironment``.
136
136
137
137
* ``<T> T getSource()`` - the ``source`` object is used to get information for a field. Its the object that is the result
138
-
of the parent field fetch. In the common case it is an in memory DTO object and hence simple POJO getters will be used for fields values. In more complex cases, you may examine it to know
139
-
how to get the specific information for the current field. As the graphql field tree is executed, each returned field value
140
-
becomes the ``source`` object for child fields.
138
+
of the parent field fetch. In the common case it is an in memory DTO object and hence simple POJO getters will be used for fields values. In more complex cases, you may examine it to know
139
+
how to get the specific information for the current field. As the graphql field tree is executed, each returned field value
140
+
becomes the ``source`` object for child fields.
141
141
142
142
* ``<T> T getRoot()`` - this special object is used to seed the graphql query. The ``root`` and the ``source`` is the same thing for the
143
-
top level fields. The root object never changes during the query and it may be null and hence no used.
143
+
top level fields. The root object never changes during the query and it may be null and hence no used.
144
144
145
145
* ``Map<String, Object> getArguments()`` - this represents the arguments that have been provided on a field and the values of those
146
-
arguments that have been resolved from passed in variables, AST literals and default argument values. You use the arguments
147
-
of a field to control what values it returns.
148
-
149
-
* ``<T> T getContext()`` - the context object is set up when the query is first executed and stays the same over the lifetime
150
-
of the query. The context can be any value and is typically used to give each data fetcher some calling context needed
151
-
when trying to get field data. For example the current user credentials or the database connection parameters could be contained
152
-
with a ``context`` object so that data fetchers can make business layer calls. One of the key design decisions you have as a graphql
153
-
system designer is how you will use context in your fetchers if at all. Some people use a dependency framework that injects context into
154
-
data fetchers automatically and hence don't need to use this.
146
+
arguments that have been resolved from passed in variables, AST literals and default argument values. You use the arguments
147
+
of a field to control what values it returns.
155
148
149
+
* ``<T> T getGraphQLContext()`` - the context object is set up when the query is first executed and stays the same over the lifetime
150
+
of the query. The context is a map that can contain any value and is typically used to give each data fetcher some calling context needed
151
+
when trying to get field data. For example the current user credentials or the database connection parameters could be contained
152
+
with a context object so that data fetchers can make business layer calls. One of the key design decisions you have as a graphql
153
+
system designer is how you will use context in your fetchers if at all. Some people use a dependency framework that injects context into
154
+
data fetchers automatically and hence don't need to use this.
156
155
157
156
* ``ExecutionStepInfo getExecutionStepInfo()`` - the field type information is a catch all bucket of field type information that is built up as
158
-
the query is executed. The following section explains more on this.
157
+
the query is executed. The following section explains more on this.
159
158
160
159
* ``DataFetchingFieldSelectionSet getSelectionSet()`` - the selection set represents the child fields that have been "selected" under neath the
161
-
currently executing field. This can be useful to help look ahead to see what sub field information a client wants. The following section explains more on this.
160
+
currently executing field. This can be useful to help look ahead to see what sub field information a client wants. The following section explains more on this.
162
161
163
162
* ``ExecutionId getExecutionId()`` - each query execution is given a unique id. You can use this perhaps on logs to tag each individual
0 commit comments