Interface ResponseValidator
public interface ResponseValidator
The
ResponseValidator requires the parameters in a specific format to be able to
parse and validate them. This is especially true for exploded parameters. The following table shows how the
value of a parameter of a response must be stored in a ValidatableResponse object. For these examples the key
of those values is always color.
These are the initial values for each type:- primitive (string) -> "blue"
- array -> ["blue","black","brown"]
- object -> { "R": 100, "G": 200, "B": 150 }
ValidatedRequest.getHeaders()
+--------+---------+-------+-----------+------------------------------------+-------------------------+ | style | explode | empty | primitive | array | object | +--------+---------+-------+-----------+------------------------------------+-------------------------+ | simple | false | | blue | blue,black,brown | R,100,G,200,B,150 | +--------+---------+-------+-----------+------------------------------------+-------------------------+ | simple | true | | blue | blue,black,brown | R=100,G=200,B=150 | +--------+---------+-------+-----------+------------------------------------+-------------------------+
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseValidatorcreate(Vertx vertx, OpenAPIContract contract) Create a newResponseValidator.validate(ValidatableResponse params, String operationId) Validates the passed response parameters against the operation defined in the related OpenAPI contract.
-
Method Details
-
create
Create a newResponseValidator.- Parameters:
vertx- the related Vert.x instancecontract- the relatedOpenAPIContract- Returns:
- an instance of
ResponseValidator.
-
validate
Validates the passed response parameters against the operation defined in the related OpenAPI contract.- Parameters:
params- the response parameters to validate.operationId- the id of the related operation.- Returns:
- A succeeded Future with the parsed and validated response parameters, or a failed Future containing ValidationException.
-