Class RequestValidator
- All Implemented Interfaces:
MutinyDelegate
RequestValidator 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 request must be stored in a ValidatableRequest 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.getCookies()
+--------+---------+-------+-----------+------------------------------------+-------------------------+ | style | explode | empty | primitive | array | object | +--------+---------+-------+-----------+------------------------------------+-------------------------+ | form | false | | blue | blue,black,brown | R,100,G,200,B,150 | +--------+---------+-------+-----------+------------------------------------+-------------------------+ | form | true | | blue | color=blue&color=black&color=brown | R=100&G=200&B=150 | +--------+---------+-------+-----------+------------------------------------+-------------------------+For header parameters
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 | +--------+---------+-------+-----------+------------------------------------+-------------------------+For path parameters
ValidatedRequest.getPathParameters()
+--------+---------+--------+-------------+-------------------------------------+--------------------------+ | 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 | +--------+---------+--------+------ ------+-------------------------------------+--------------------------+ | label | false | . | .blue | .blue,black,brown | .R,100,G,200,B,150 | +--------+---------+--------+-------------+-------------------------------------+--------------------------+ | label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 | +--------+---------+--------+-------------+-------------------------------------+--------------------------+ | matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 | +--------+---------+-------+--------+-------------------------------------------+--------------------------+ | matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 | +--------+---------+--------+-------------+-------------------------------------+--------------------------+For query parameters
ValidatedRequest.getQuery()
+----------------+---------+-------+------------+-----------------------------------+--------------------------+ | style | explode | empty | primitive | array | object | +----------------+---------+-------+----------+-------------------------------------+--------------------------+ | form | false | | blue | blue,black,brown | R,100,G,200,B,150 | +----------------+---------+-------+-----------+------------------------------------+--------------------------+ | form | true | | blue | color=blue&color=black&color=brown | R=100&G=200&B=150 | +----------------+---------+-------+------ ----+------------------------------------+--------------------------+ | spaceDelimited | false | not yet supported / +----------------+---------+-------+------ ----+------------------------------------+--------------------------+ | spaceDelimited | true | not yet supported / +----------------+---------+-------+------ ----+------------------------------------+--------------------------+ | pipeDelimited | false | not yet supported / +----------------+---------+-------+------ ----+------------------------------------+--------------------------+ | pipeDelimited | true | not yet supported / +----------------+---------+-------+------ ----+------------------------------------+--------------------------+ | spaceDelimited | true | not yet supported / +----------------+---------+-------+------ ----+------------------------------------+--------------------------+NOTE: This class has been automatically generated from the
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRequestValidator(io.vertx.openapi.validation.RequestValidator delegate) RequestValidator(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionstatic RequestValidatorcreate(Vertx vertx, OpenAPIContract contract) booleanio.vertx.openapi.validation.RequestValidatorinthashCode()static RequestValidatornewInstance(io.vertx.openapi.validation.RequestValidator arg) toString()io.smallrye.mutiny.Uni<ValidatedRequest>validate(HttpServerRequest request) Likevalidate(io.vertx.mutiny.core.http.HttpServerRequest), but the operationId andValidatableRequestare determined from the passed request.io.smallrye.mutiny.Uni<ValidatedRequest>validate(HttpServerRequest request, String operationId) Likevalidate(io.vertx.mutiny.core.http.HttpServerRequest), butValidatableRequestare directly extracted from the passed request.io.smallrye.mutiny.Uni<ValidatedRequest>validate(ValidatableRequest params, String operationId) Validates the passed request parameters against the operation defined in the related OpenAPI contract.validateAndAwait(HttpServerRequest request) Blocking variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest).validateAndAwait(HttpServerRequest request, String operationId) Blocking variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest,String).validateAndAwait(ValidatableRequest params, String operationId) Blocking variant ofvalidate(io.vertx.mutiny.openapi.validation.ValidatableRequest,String).voidvalidateAndForget(HttpServerRequest request) Variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest)that ignores the result of the operation.voidvalidateAndForget(HttpServerRequest request, String operationId) Variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest,String)that ignores the result of the operation.voidvalidateAndForget(ValidatableRequest params, String operationId) Variant ofvalidate(io.vertx.mutiny.openapi.validation.ValidatableRequest,String)that ignores the result of the operation.
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
RequestValidator
public RequestValidator(io.vertx.openapi.validation.RequestValidator delegate) -
RequestValidator
-
-
Method Details
-
getDelegate
public io.vertx.openapi.validation.RequestValidator getDelegate()- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
create
- Parameters:
vertx- the related Vert.x instancecontract- the related- Returns:
- an instance of
RequestValidator.
-
validate
@CheckReturnValue public io.smallrye.mutiny.Uni<ValidatedRequest> validate(HttpServerRequest request) Likevalidate(io.vertx.mutiny.core.http.HttpServerRequest), but the operationId andValidatableRequestare determined from the passed request. Note: Determining the operationId is expensive. If possible usevalidate(io.vertx.mutiny.core.http.HttpServerRequest).Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
request- the request to validate- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
validateAndAwait
Blocking variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
request- the request to validate- Returns:
- the ValidatedRequest instance produced by the operation.
-
validateAndForget
Variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest)that ignores the result of the operation.This method subscribes on the result of
validate(io.vertx.mutiny.core.http.HttpServerRequest), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromvalidate(io.vertx.mutiny.core.http.HttpServerRequest)but you don't need to compose it with other operations.- Parameters:
request- the request to validate
-
validate
@CheckReturnValue public io.smallrye.mutiny.Uni<ValidatedRequest> validate(HttpServerRequest request, String operationId) Likevalidate(io.vertx.mutiny.core.http.HttpServerRequest), butValidatableRequestare directly extracted from the passed request.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
request- the request to validateoperationId- the id of the related operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
validateAndAwait
Blocking variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
request- the request to validateoperationId- the id of the related operation.- Returns:
- the ValidatedRequest instance produced by the operation.
-
validateAndForget
Variant ofvalidate(io.vertx.mutiny.core.http.HttpServerRequest,String)that ignores the result of the operation.This method subscribes on the result of
validate(io.vertx.mutiny.core.http.HttpServerRequest,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromvalidate(io.vertx.mutiny.core.http.HttpServerRequest,String)but you don't need to compose it with other operations.- Parameters:
request- the request to validateoperationId- the id of the related operation.
-
validate
@CheckReturnValue public io.smallrye.mutiny.Uni<ValidatedRequest> validate(ValidatableRequest params, String operationId) Validates the passed request parameters against the operation defined in the related OpenAPI contract.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
params- the request parameters to validate.operationId- the id of the related operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
validateAndAwait
Blocking variant ofvalidate(io.vertx.mutiny.openapi.validation.ValidatableRequest,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
params- the request parameters to validate.operationId- the id of the related operation.- Returns:
- the ValidatedRequest instance produced by the operation.
-
validateAndForget
Variant ofvalidate(io.vertx.mutiny.openapi.validation.ValidatableRequest,String)that ignores the result of the operation.This method subscribes on the result of
validate(io.vertx.mutiny.openapi.validation.ValidatableRequest,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromvalidate(io.vertx.mutiny.openapi.validation.ValidatableRequest,String)but you don't need to compose it with other operations.- Parameters:
params- the request parameters to validate.operationId- the id of the related operation.
-
newInstance
-