Package io.vertx.reactivex.openapi.validation

## Class RequestValidator

- java.lang.Object
- - io.vertx.reactivex.openapi.validation.RequestValidator

-     public class RequestValidator
      extends Object

  The `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 }
  For cookie parameters `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 RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<RequestValidator>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RequestValidator​(RequestValidator delegate)` |
    `RequestValidator​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static RequestValidator` | `create​(Vertx vertx, OpenAPIContract contract)` | Create a new `RequestValidator`.
    `boolean` | `equals​(Object o)` |
    `RequestValidator` | `getDelegate()` |
    `int` | `hashCode()` |
    `static RequestValidator` | `newInstance​(RequestValidator arg)` |
    `Single<ValidatedRequest>` | `rxValidate​(HttpServerRequest request)` | Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but the operationId and `ValidatableRequest` are determined from the passed request.
    `Single<ValidatedRequest>` | `rxValidate​(HttpServerRequest request, String operationId)` | Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but `ValidatableRequest` are directly extracted from the passed request.
    `Single<ValidatedRequest>` | `rxValidate​(ValidatableRequest params, String operationId)` | Validates the passed request parameters against the operation defined in the related OpenAPI contract.
    `String` | `toString()` |
    `Future<ValidatedRequest>` | `validate​(HttpServerRequest request)` | Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but the operationId and `ValidatableRequest` are determined from the passed request.
    `Future<ValidatedRequest>` | `validate​(HttpServerRequest request, String operationId)` | Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but `ValidatableRequest` are directly extracted from the passed request.
    `Future<ValidatedRequest>` | `validate​(ValidatableRequest params, String operationId)` | Validates the passed request parameters against the operation defined in the related OpenAPI contract.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<RequestValidator> __TYPE_ARG

  - ### Constructor Detail

    - #### RequestValidator

          public RequestValidator​(RequestValidator delegate)

    - #### RequestValidator

          public RequestValidator​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public RequestValidator getDelegate()

    - #### create

          public static RequestValidator create​(Vertx vertx,
                                                OpenAPIContract contract)

      Create a new `RequestValidator`.
      Parameters:
        `vertx` - the related Vert.x instance
        `contract` - the related
      Returns:
        an instance of `RequestValidator`.

    - #### validate

          public Future<ValidatedRequest> validate​(HttpServerRequest request)

      Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but the operationId and `ValidatableRequest` are determined from the passed request.

      Note: Determining the operationId is expensive. If possible use `validate(io.vertx.reactivex.core.http.HttpServerRequest)`.
      Parameters:
        `request` - the request to validate
      Returns:
        A succeeded Future with the parsed and validated request parameters, or a failed Future containing ValidationException.

    - #### rxValidate

          public Single<ValidatedRequest> rxValidate​(HttpServerRequest request)

      Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but the operationId and `ValidatableRequest` are determined from the passed request.

      Note: Determining the operationId is expensive. If possible use `validate(io.vertx.reactivex.core.http.HttpServerRequest)`.
      Parameters:
        `request` - the request to validate
      Returns:
        A succeeded Future with the parsed and validated request parameters, or a failed Future containing ValidationException.

    - #### validate

          public Future<ValidatedRequest> validate​(HttpServerRequest request,
                                                   String operationId)

      Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but `ValidatableRequest` are directly extracted from the passed request.
      Parameters:
        `request` - the request to validate
        `operationId` - the id of the related operation.
      Returns:
        A succeeded Future with the parsed and validated request parameters, or a failed Future containing ValidationException.

    - #### rxValidate

          public Single<ValidatedRequest> rxValidate​(HttpServerRequest request,
                                                     String operationId)

      Like `validate(io.vertx.reactivex.core.http.HttpServerRequest)`, but `ValidatableRequest` are directly extracted from the passed request.
      Parameters:
        `request` - the request to validate
        `operationId` - the id of the related operation.
      Returns:
        A succeeded Future with the parsed and validated request parameters, or a failed Future containing ValidationException.

    - #### validate

          public Future<ValidatedRequest> validate​(ValidatableRequest params,
                                                   String operationId)

      Validates the passed request parameters against the operation defined in the related OpenAPI contract.
      Parameters:
        `params` - the request parameters to validate.
        `operationId` - the id of the related operation.
      Returns:
        A succeeded Future with the parsed and validated request parameters, or a failed Future containing ValidationException.

    - #### rxValidate

          public Single<ValidatedRequest> rxValidate​(ValidatableRequest params,
                                                     String operationId)

      Validates the passed request parameters against the operation defined in the related OpenAPI contract.
      Parameters:
        `params` - the request parameters to validate.
        `operationId` - the id of the related operation.
      Returns:
        A succeeded Future with the parsed and validated request parameters, or a failed Future containing ValidationException.

    - #### newInstance

          public static RequestValidator newInstance​(RequestValidator arg)