- policyRef:
name: graphql-schema-validation-flex
config:
source: <string> // OPTIONAL, default: context; values: "context" or "inline"
schema: <string> // REQUIRED when source is inline; omit when source is context
blockOperation: <boolean> // OPTIONAL, default: true
GraphQL Schema Validation Policy
Policy Name |
GraphQL Schema Validation |
Summary |
Validates incoming GraphQL operations against a GraphQL schema definition |
Category |
Security |
First Omni Gateway version available |
v1.13.0 |
Returned status codes |
400 - The operation doesn’t satisfy the schema. When Block request is enabled, the JSON response includes GraphQL-style |
Summary
The GraphQL Schema Validation policy applies standard GraphQL validation rules, including field and argument correctness, fragments, directives, unions, interfaces, and other specification rules.
The policy loads the schema in these ways:
-
If
sourceiscontext, Flex Gateway automatically loads the schema file from the API asset in Anypoint Exchange. -
If
sourceisinline, provide the schema text directly in the policy configuration. This is required for local mode or environments not connected to Exchange.
If the document includes an @link to the Apollo Federation specification URL, Omni Gateway uses this schema to validate all incoming requests.
After Omni Gateway extracts inline GraphQL operation text from the request, the policy runs validation. If Omni Gateway can’t resolve normal operation text, such as persisted query flows, it skips these checks and logs a warning before it forwards the request to the upstream.
Configuring Policy Parameters
Omni Gateway Local Mode
When you apply the policy via declarative configuration files, Refer to the following policy definition and table of parameters:
| Parameter | Required | Default Value | Description |
|---|---|---|---|
|
No |
|
Where Omni Gateway retrieves the schema for validation. If set to |
|
No |
NA |
The schema text used for validation. Required when |
|
No |
|
How Omni Gateway handles requests that fail validation. If |
Managed Omni Gateway and Omni Gateway Connected Mode
When you apply the policy from the UI, the following parameters are displayed:
| Field | Description | Default Value | Required |
|---|---|---|---|
Block request |
If enabled and the operation doesn’t conform to the schema, Omni Gateway returns a |
Enabled |
Yes |



