JSON Validator Policy
Use the JSON Validator policy to validate a request against a JSON schema. Limit JSON structures to minimize content-level attacks.
application/json.
Policy execution order
This JSON Validator policy executes after the request is authenticated.
Policy fields include:
| Field/Field set | Description |
|---|---|
| When this policy should be applied | An expression that defines one or more conditions that must be
true for the policy to execute.
Example: The expression |
| Edit Json Schema | Launches the JSON editor to compose the schema to use for validation. The editor loads an
existing JSON document if defined previously. Default value: Empty JSON file Example:
|
| Description |
A customizable description. Default value: Requests are being validated against the specified schema |
Troubleshooting policy violations
The JSON Validator policy now returns the actual policy violation error to the API caller.
Each error type is parameterized and added to the response in the "SL_Policy_Error" header.
The following image provides an example of a policy violation error.
First, a required field (productId) is missing a value. Secondly, the value for the price field is invalid.