Class OpenapiRequestValidator
java.lang.Object
ch.nexsol.gateway.validation.OpenapiRequestValidator
Validates a request against the operation the contract resolved for it: its parameters
first, then its body.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidateBody(OpenapiContract contract, String operationKey, OpenapiContract.Resolution.Found found, org.springframework.http.MediaType contentType, byte[] body) Validates the request body against the schema the contract declares for the operation.validateParameters(OpenapiContract contract, String operationKey, OpenapiContract.Resolution.Found found, org.springframework.http.server.reactive.ServerHttpRequest request) Validates the path, query, header and cookie parameters the contract declares for the operation.
-
Constructor Details
-
OpenapiRequestValidator
public OpenapiRequestValidator()
-
-
Method Details
-
validateParameters
public ValidationReport validateParameters(OpenapiContract contract, String operationKey, OpenapiContract.Resolution.Found found, org.springframework.http.server.reactive.ServerHttpRequest request) Validates the path, query, header and cookie parameters the contract declares for the operation.- Parameters:
contract- the contract the schemas are compiled fromoperationKey- the operation, asMETHOD /template, used to key the compiled schemasfound- the resolved operationrequest- the request being validated- Returns:
- the violations found
-
validateBody
public ValidationReport validateBody(OpenapiContract contract, String operationKey, OpenapiContract.Resolution.Found found, org.springframework.http.MediaType contentType, byte[] body) Validates the request body against the schema the contract declares for the operation.- Parameters:
contract- the contract the schemas are compiled fromoperationKey- the operation, asMETHOD /template, used to key the compiled schemasfound- the resolved operationcontentType- the request media type, may benullbody- the raw request body, empty when the request carries none- Returns:
- the violations found
-