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
|`http-data-source`| Configures the HTTP request and optionally the HTTP response that are used to resolve data for the given `parent-type` and `field`. | Yes |
175
+
|`http-request`| Specifies a URL and child policies to configure the resolver's HTTP request. Each child element can be specified at most once. | Yes |
176
+
|`set-method`| Method of the resolver's HTTP request, configured using the [set-method](api-management-advanced-policies.md#SetRequestMethod) policy. | Yes |
177
+
|`set-url`| URL of the resolver's HTTP request. | Yes |
178
+
|`set-header`| Header set in the resolver's HTTP request, configured using the [set-header](api-management-transformation-policies.md#SetHTTPheader) policy. | No |
179
+
|`set-body`| Body set in the resolver's HTTP request, configured using the [set-body](api-management-transformation-policies.md#SetBody) policy. | No |
180
+
|`authentication-certificate`| Client certificate presented in the resolver's HTTP request, configured using the [authentication-certificate](api-management-authentication-policies.md#ClientCertificate) policy. | No |
181
+
|`http-response`| Optionally specifies child policies to configure the resolver's HTTP response. If not specified, the response is returned as a raw string. Each child element can be specified at most once. |
182
+
|`json-to-xml`| Transforms the resolver's HTTP response using the [json-to-xml](api-management-transformation-policies.md#ConvertJSONtoXML) policy. | No |
183
+
|`xml-to-json`| Transforms the resolver's HTTP response using the [xml-to-json](api-management-transformation-policies.md#ConvertJSONtoXML) policy. | No |
184
+
|`find-and-replace`| Transforms the resolver's HTTP response using the [find-and-replace](api-management-transformation-policies.md#Findandreplacestringinbody) policy. | No |
|`parent-type`| An object type in the GraphQL schema. | Yes | N/A |
192
+
|`field`| A field of the specified `parent-type` in the GraphQL schema. | Yes | N/A |
193
+
194
+
> [!NOTE]
195
+
> Currently, the values of `parent-type` and `field` aren't validated by this policy. If they aren't valid, the policy is ignored, and the GraphQL query is forwarded to a GraphQL endpoint (if one is configured).
196
+
197
+
### Usage
198
+
199
+
This policy can be used in the following policy [sections](./api-management-howto-policies.md#sections) and [scopes](./api-management-howto-policies.md#scopes).
200
+
201
+
-**Policy sections:** backend
202
+
-**Policy scopes:** all scopes
203
+
204
+
### GraphQL Context
205
+
206
+
The `context` variable that is passed through the request and response pipeline is augmented with the GraphQL context when used with `<set-graphql-resolver>` policies.
207
+
208
+
#### ParentResult
209
+
210
+
The `context.ParentResult` is set to the parent object for the current resolver execution. Consider the following partial schema:
If you set a resolver for `parent-type="Blog" field="comments"`, you will want to understand which blog ID to use. You can get this using `context.ParentResult.AsJObject()["id"].ToString()`. The policy for configuring this resolver would resemble:
|`http-data-source`| Configures the HTTP request and optionally the HTTP response that are used to resolve data for the given `parent-type` and `field`. | Yes |
291
-
|`http-request`| Specifies a URL and child policies to configure the resolver's HTTP request. Each child element can be specified at most once. | Yes |
292
-
|`set-method`| Method of the resolver's HTTP request, configured using the [set-method](api-management-advanced-policies.md#SetRequestMethod) policy. | Yes |
293
-
|`set-url`| URL of the resolver's HTTP request. | Yes |
294
-
|`set-header`| Header set in the resolver's HTTP request, configured using the [set-header](api-management-transformation-policies.md#SetHTTPheader) policy. | No |
295
-
|`set-body`| Body set in the resolver's HTTP request, configured using the [set-body](api-management-transformation-policies.md#SetBody) policy. | No |
296
-
|`authentication-certificate`| Client certificate presented in the resolver's HTTP request, configured using the [authentication-certificate](api-management-authentication-policies.md#ClientCertificate) policy. | No |
297
-
|`http-response`| Optionally specifies child policies to configure the resolver's HTTP response. If not specified, the response is returned as a raw string. Each child element can be specified at most once. |
298
-
|`json-to-xml`| Transforms the resolver's HTTP response using the [json-to-xml](api-management-transformation-policies.md#ConvertJSONtoXML) policy. | No |
299
-
|`xml-to-json`| Transforms the resolver's HTTP response using the [xml-to-json](api-management-transformation-policies.md#ConvertJSONtoXML) policy. | No |
300
-
|`find-and-replace`| Transforms the resolver's HTTP response using the [find-and-replace](api-management-transformation-policies.md#Findandreplacestringinbody) policy. | No |
|`parent-type`| An object type in the GraphQL schema. | Yes | N/A |
308
-
|`field`| A field of the specified `parent-type` in the GraphQL schema. | Yes | N/A |
309
-
310
-
> [!NOTE]
311
-
> Currently, the values of `parent-type` and `field` aren't validated by this policy. If they aren't valid, the policy is ignored, and the GraphQL query is forwarded to a GraphQL endpoint (if one is configured).
312
-
313
-
### Usage
314
-
315
-
This policy can be used in the following policy [sections](./api-management-howto-policies.md#sections) and [scopes](./api-management-howto-policies.md#scopes).
0 commit comments