io.vertx.openapi.validation

## 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 }
  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       |
       +--------+---------+-------+-----------+------------------------------------+-------------------------+

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ResponseValidator` | `create(Vertx vertx, OpenAPIContract contract)` Create a new `ResponseValidator`.
    `Future<ValidatedResponse>` | `validate(ValidatableResponse params, String operationId)` Validates the passed response parameters against the operation defined in the related OpenAPI contract.

- - ### Method Detail

    - #### create

          static ResponseValidator create(Vertx vertx,
                                          OpenAPIContract contract)

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

    - #### validate

          Future<ValidatedResponse> validate(ValidatableResponse params,
                                             String operationId)

      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.

Copyright © 2024 Eclipse. All rights reserved.