With the JSON Schema Validation Policy, the part of the incoming message specified with JSONPath is validated.
If the part of the incoming message specified by JSONPath does not conform to the schema, the message is blocked from being sent to the Backend API. Thus, the Backend API is prevented from processing such erroneous or malicious messages, ensuring that it remains stable or does not perform unnecessary operations.
The use of this policy makes sense if the message body from the client is JSON.
The picture below shows the policy settings:
The policy fields are shown in the table below.
Field
Description
Name
The name can be written to facilitate the use and management of the policy. You will need this name during the management and selection of policies.
Description
An optional description of the policy that may be useful for usage and management activities.
JSONPath
It specifies which part of the request message will undergo the validation process.
A JSONPath expression is entered as the value. Leaving it blank or entering $. will process the entire message body. The default value is set to retrieve the entire message body.
Schema
JSON schema(s) are entered. If multiple JSON schemas are entered, each schema is individually validated for the target path (or the entire body if empty).
Test JSON Path
JSONPath can be tested with an example JSON data.
You can visit thePoliciespage for the details of theConditionsandError Message Customizationpanels.