Skip to content

Commit 282daa7

Browse files
authored
Merge pull request #203053 from dlepow/polorder
[APIM] Order of policy elements
2 parents f2ba908 + 2ca3af4 commit 282daa7

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

articles/api-management/graphql-policies.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ This article provides a reference for API Management policies to validate and re
2525

2626
The `validate-graphql-request` policy validates the GraphQL request and authorizes access to specific query paths. An invalid query is a "request error". Authorization is only done for valid requests.
2727

28-
[!INCLUDE [api-management-policy-generic-alert](../../includes/api-management-policy-generic-alert.md)]
29-
30-
3128
**Permissions**
3229
Because GraphQL queries use a flattened schema:
3330
* Permissions may be applied at any leaf node of an output type:
@@ -38,7 +35,7 @@ Because GraphQL queries use a flattened schema:
3835
* Fragments
3936
* Unions
4037
* Interfaces
41-
* The schema element
38+
* The schema element
4239

4340
**Authorize element**
4441
Configure the `authorize` element to set an appropriate authorization rule for one or more paths.
@@ -48,6 +45,8 @@ Configure the `authorize` element to set an appropriate authorization rule for o
4845
**Introspection system**
4946
The policy for path=`/__*` is the [introspection](https://graphql.org/learn/introspection/) system. You can use it to reject introspection requests (`__schema`, `__type`, etc.).
5047

48+
[!INCLUDE [api-management-policy-generic-alert](../../includes/api-management-policy-generic-alert.md)]
49+
5150
### Policy statement
5251

5352
```xml
@@ -152,12 +151,16 @@ The `set-graphql-resolver` policy retrieves or sets data for a GraphQL field in
152151
<set-graphql-resolver parent-type="type" field="field">
153152
<http-data-source>
154153
<http-request>
155-
<set-method>HTTP method</set-method>
154+
<set-method>...set-method policy configuration...</set-method>
156155
<set-url>URL</set-url>
157-
[...]
156+
<set-header>...set-header policy configuration...</set-header>
157+
<set-body>...set-body policy configuration...</set-body>
158+
<authentication-certificate>...authentication-certificate policy configuration...</authentication-certificate>
158159
</http-request>
159160
<http-response>
160-
[...]
161+
<json-to-xml>...json-to-xml policy configuration...</json-to-xml>
162+
<xml-to-json>...xml-to-json policy configuration...</xml-to-json>
163+
<find-and-replace>...find-and-replace policy configuration...</find-and-replace>
161164
</http-response>
162165
</http-data-source>
163166
</set-graphql-resolver>
@@ -285,9 +288,17 @@ type User {
285288
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
286289
| `set-graphql-resolver` | Root element. | Yes |
287290
| `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 |
288-
| `http-request` | Specifies a URL and child policies to configure the resolver's HTTP request. Each of the following policies can be specified at most once in the element. <br/><br/>Required policy: [set-method](api-management-advanced-policies.md#SetRequestMethod)<br/><br/>Optional policies: [set-header](api-management-transformation-policies.md#SetHTTPheader), [set-body](api-management-transformation-policies.md#SetBody), [authentication-certificate](api-management-authentication-policies.md#ClientCertificate) | Yes |
289-
| `set-url` | The URL of the resolver's HTTP request. | Yes |
290-
| `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 of the following policies can be specified at most once. <br/><br/>Optional policies: [set-body](api-management-transformation-policies.md#SetBody), [json-to-xml](api-management-transformation-policies.md#ConvertJSONtoXML), [xml-to-json](api-management-transformation-policies.md#ConvertXMLtoJSON), [find-and-replace](api-management-transformation-policies.md#Findandreplacestringinbody) | No |
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 |
301+
291302

292303
### Attributes
293304

articles/api-management/set-edit-policies.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ To configure a policy:
106106
</on-error>
107107
</policies>
108108
```
109+
> [!NOTE]
110+
> Set a policy's elements and child elements in the order provided in the policy statement.
111+
109112
1. Select **Save** to propagate changes to the API Management gateway immediately.
110113

111114
The **ip-filter** policy now appears in the **Inbound processing** section.

includes/api-management-policy-generic-alert.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
author: dlepow
33
ms.service: api-management
44
ms.topic: include
5-
ms.date: 03/15/2022
5+
ms.date: 06/27/2022
66
ms.author: danlep
77
---
8-
> [!TIP]
9-
> Learn [how to set or edit API Management policies](../articles/api-management/set-edit-policies.md).
8+
> [!NOTE]
9+
> Set a policy's elements and child elements in the order provided in the policy statement. Learn more about [how to set or edit API Management policies](../articles/api-management/set-edit-policies.md).

0 commit comments

Comments
 (0)