GraphQL Cost Analysis

Use the GraphQL Cost Analysis policy to return a cost analysis of a target query.

Gateway support

Table 1. Table showing which gateways support this policy, and the corresponding policy version
Gateway Policy version
DataPower® API Gateway 2.0.0

This topic describes how to configure the policy in the assembly user interface; for details on how to configure the policy in your OpenAPI source, see graphql-cost-analysis.

Properties

The following table lists the policy properties, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.

Table 2. GraphQL Cost Analysis policy properties
Property label Required Description Data type
Title No The title of the policy.

The default value is graphql-introspect.

string
Description No A description of the policy. string
Input No

A variable in the API context that contains the input to the GraphQL cost analysis. The content of the body field of the variable is the GraphQL cost query. By default, the variable name is message. The query should be in the format as specified in the IBM GraphQL Cost Directives specification, see Introspection of Cost Analysis Results: __cost.

string
Output No

A variable in the API context where the results of the GraphQL cost analysis are stored. The content of the body field of the variable is the result of GraphQL cost analysis. The default variable name is the same as that of the variable specified for the input field. Therefore, by default, the input of the GraphQL cost analysis is overwritten by the output.

string
Target No

A variable in the API context that contains the target for the GraphQL cost analysis. The content of the body field of the variable is the GraphQL context. By default, the variable name is graphql_execute_args. The target context specifies the query to analyze and, optionally, the result of the query execution.

string