Skip to content

Commit c55ae57

Browse files
authored
Merge pull request #245726 from dlepow/testresolve
[APIM] Test single resolver
2 parents 151bde2 + cb8c0ad commit c55ae57

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

articles/api-management/configure-graphql-resolver.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Currently, API Management supports resolvers that can access the following data
2525
* A resolver is a resource containing a policy definition that's invoked only when a matching object type and field in the schema is executed.
2626
* Each resolver resolves data for a single field. To resolve data for multiple fields, configure a separate resolver for each.
2727
* Resolver-scoped policies are evaluated *after* any `inbound` and `backend` policies in the policy execution pipeline. They don't inherit policies from other scopes. For more information, see [Policies in API Management](api-management-howto-policies.md).
28-
28+
* You can configure API-scoped policies for a GraphQL API, independent of the resolver-scoped policies. For example, add a [validate-graphql-request](validate-graphql-request-policy.md) policy to the `inbound` scope to validate the request before the resolver is invoked. Configure API-scoped policies on the **API policies** tab for the API.
2929

3030
> [!IMPORTANT]
3131
> * If you use the preview `set-graphql-resolver` policy in policy definitions, you should migrate to the managed resolvers described in this article.
@@ -59,13 +59,36 @@ The following steps create a resolver using an HTTP-based data source. The gener
5959

6060
:::image type="content" source="media/configure-graphql-resolver/configure-resolver-policy.png" alt-text="Screenshot of resolver policy editor in the portal." lightbox="media/configure-graphql-resolver/configure-resolver-policy.png":::
6161

62-
1. The resolver is attached to the field. Go to the **Resolvers** tab to list and manage the resolvers configured for the API. You can also create resolvers from the **Resolvers** tab.
62+
The resolver is attached to the field and appears on the **Resolvers** tab.
63+
6364

6465
:::image type="content" source="media/configure-graphql-resolver/list-resolvers.png" alt-text="Screenshot of the resolvers list for GraphQL API in the portal." lightbox="media/configure-graphql-resolver/list-resolvers.png":::
6566

66-
> [!TIP]
67-
> * The **Linked** column indicates whether the resolver is configured for a field that's currently in the GraphQL schema. If a resolver isn't linked, it can't be invoked.
68-
> * You can clone a listed resolver to quickly create a similar resolver that targets a different type and field. In the context menu (**...**), select **Clone**.
67+
## Manage resolvers
68+
69+
List and manage the resolvers for a GraphQL API on the API's **Resolvers** tab.
70+
71+
:::image type="content" source="media/configure-graphql-resolver/resolvers-tab.png" alt-text="Screenshot of managing resolvers for GraphQL API in the portal." lightbox="media/configure-graphql-resolver/resolvers-tab.png":::
72+
73+
On the **Resolvers** tab:
74+
75+
* The **Linked** column indicates whether the resolver is configured for a field that's currently in the GraphQL schema. If a resolver isn't linked, it can't be invoked.
76+
77+
* In the context menu (**...**) for a resolver, find commands to **Clone**, **Edit**, or **Delete** a resolver. Clone a listed resolver to quickly create a similar resolver that targets a different type and field.
78+
79+
* You can create a new resolver by selecting **+ Create**.
80+
81+
## Edit and test a resolver
82+
83+
When you edit a single resolver, the **Edit resolver** page opens. You can:
84+
85+
* Update the resolver policy and optionally the data source. Changing the data source overwrites the current resolver policy.
86+
87+
* Change the type and field that the resolver targets.
88+
89+
* Test and debug the resolver's configuration. As you edit the resolver policy, select **Run Test** to check the output from the data source, which you can validate against the schema. If errors occur, the response includes troubleshooting information.
90+
91+
:::image type="content" source="media/configure-graphql-resolver/edit-resolver.png" alt-text="Screenshot of editing a resolver in the portal." lightbox="media/configure-graphql-resolver/edit-resolver.png":::
6992

7093
## GraphQL context
7194

articles/api-management/graphql-schema-resolve-api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ type User {
107107
1. Select **Create**.
108108
1. To resolve data for another field in the schema, repeat the preceding steps to create a resolver.
109109

110+
> [!TIP]
111+
> As you edit a resolver policy, select **Run Test** to check the output from the data source, which you can validate against the schema. If errors occur, the response includes troubleshooting information.
112+
110113
[!INCLUDE [api-management-graphql-test.md](../../includes/api-management-graphql-test.md)]
111114

112115
## Secure your GraphQL API
115 KB
Loading
70.2 KB
Loading

0 commit comments

Comments
 (0)