Class OpenapiResponseValidator
java.lang.Object
ch.nexsol.gateway.validation.OpenapiResponseValidator
Validates a response against the operation the contract resolved for the request: that
the status is one the contract declares, that the headers it requires are there, and
that the body honours the declared schema.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidate(OpenapiContract contract, String operationKey, OpenapiContract.Resolution.Found found, int statusCode, org.springframework.http.HttpHeaders headers, byte[] body) Validates a response against the contract.
-
Constructor Details
-
OpenapiResponseValidator
public OpenapiResponseValidator()
-
-
Method Details
-
validate
public ValidationReport validate(OpenapiContract contract, String operationKey, OpenapiContract.Resolution.Found found, int statusCode, org.springframework.http.HttpHeaders headers, byte[] body) Validates a response against the contract.- Parameters:
contract- the contract the schemas are compiled fromoperationKey- the operation, asMETHOD /template, used to key the compiled schemasfound- the operation the request was resolved tostatusCode- the status the downstream service answered withheaders- the response headersbody- the raw response body, empty when the response carries none, andnullwhen it was not read- Returns:
- the violations found
-