Version: 2.1.0
request-validation
Summary#
Name#
request-validation plugin validates the requests before forwarding to an upstream service. The validation plugin uses
json-schema to validate the schema. The plugin can be used to validate the headers and body data.
For more information on schema, refer to JSON schema for more information.
Attributes#
| Name | Type | Requirement | Default | Valid | Description |
|---|---|---|---|---|---|
| header_schema | object | optional | schema for the header data | ||
| body_schema | object | optional | schema for the body data |
How To Enable#
Create a route and enable the request-validation plugin on the route:
Test Plugin#
If the schema is violated the plugin will yield a 400 bad request.
Disable Plugin#
Remove the corresponding json configuration in the plugin configuration to disable the request-validation.
APISIX plugins are hot-reloaded, therefore no need to restart APISIX.
Examples:#
Enum validate:
Boolean validate:
Number or Integer validate:
String validate:
Regex validate:
Array validate:
Multi-field combination verification: