validate
Use the validate policy to validate the payload in an assembly flow against a schema.
Restriction:
- The schema that represents the XML can reference only one XML namespace.
- The schema cannot reference polymorphic XML elements.
- The OpenAPI
discriminator
field is not supported by the validate policy. - The validate policy can be used only with the DataPower® Gateway, not with the Micro Gateway.
The validate policy has the following format:
- validate:
title: title
description: description
definition: swagger_schema_definition_to_be_used
Apply this policy by adding an assembly extension with an execute field to your OpenAPI (Swagger 2.0) definition file.
The following table describes the policy properties:
Property | Required | Description | Data type |
---|---|---|---|
title | No | A title for the policy. | string |
description | No | A policy description. | string |
definition | Yes | The schema to be used to validate the payload. Valid values:
|
string |
You can also apply an validate policy by using the API Designer assembly editor to add a built-in policy to the API. For more information, see Validate (validate) in the built-in policies section.
Example 1
validate:
title: validate the response
definition: #/definitions/RouteOutput