RequestValidationConfig
Defined in: src/policies/transform/request-validation.ts:20
Configuration for the requestValidation policy.
Extends
Section titled “Extends”Properties
Section titled “Properties”contentTypes?
Section titled “contentTypes?”
optionalcontentTypes:string[]
Defined in: src/policies/transform/request-validation.ts:38
Only validate these content types.
Requests with other content types pass through without validation.
Default: ["application/json"].
errorMessage?
Section titled “errorMessage?”
optionalerrorMessage:string
Defined in: src/policies/transform/request-validation.ts:40
Custom error message prefix. Default: "Request validation failed".
skip()?
Section titled “skip()?”
optionalskip: (c) =>boolean|Promise<boolean>
Defined in: src/policies/types.ts:33
Skip this policy when condition returns true
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean | Promise<boolean>
Inherited from
Section titled “Inherited from”validate()?
Section titled “validate()?”
optionalvalidate: (body) =>boolean|ValidationResult
Defined in: src/policies/transform/request-validation.ts:25
Synchronous validation function.
Return true/false or an object with optional error details.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean | ValidationResult
validateAsync()?
Section titled “validateAsync()?”
optionalvalidateAsync: (body) =>Promise<boolean|ValidationResult>
Defined in: src/policies/transform/request-validation.ts:30
Async validation function (e.g., for remote schema validation).
If both validate and validateAsync are provided, validateAsync takes precedence.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Promise<boolean | ValidationResult>