Expand description
The request-validation node — validates request headers and/or body
against JSON Schemas before the request reaches the upstream, rejecting
non-conforming requests with a configurable status code.
Port of APISIX’s request-validation plugin. Schemas are compiled once at
config load (invalid schemas fail policy compilation, not requests).
Bodies are validated as JSON by default; application/x-www-form-urlencoded
bodies are decoded into a flat object first, mirroring the Lua plugin’s
ngx.decode_args shape (duplicate keys become arrays, keys without =
become true).
Structs§
- Request
Validation Plugin - Validates
context.requestheaders and body against compiled JSON Schemas. On failure the request is rejected through theerrorport with error codeVALIDATION_FAILEDand a JSON response usingrejected_code.
Functions§
- compile_
schema 🔒 - Compiles an optional schema key into a validator, failing fast with the key name on malformed schemas.
- decode_
urlencoded 🔒 - Decodes an
application/x-www-form-urlencodedbody into a flat JSON object, mirroringngx.decode_args:a=1&a=2becomes{"a": ["1","2"]}, a bareflag(no=) becomes{"flag": true}, values are percent-decoded and+maps to space. - hex_val 🔒
- urldecode 🔒
- Percent-decodes a urlencoded component (
+becomes space; malformed escapes pass through literally).