vertx/src/main/java/eu/internetofus/common/vertx/OpenAPIValidator.java
/**
   * Compose a value validation.
   *
   * @param future    to compose.
   * @param validator to execute.
   *
   * @return the future with the valid environment.
   */
Compose a value validation.
@param future    to compose.
@param validator to execute.

@return the future with the valid environment.
Compose a value validation . @param future to compose . @param validator to execute . @return the future with the valid environment .
private static <T extends Environment> Future<T> composeValidation(final Future<T> future,
      final BiFunction<Promise<T>, T, Future<T>> validator) {
    return future.compose(environment -> {
      final Promise<T> promise = Promise.promise();
      var chain = promise.future();
      try {
        chain = validator.apply(promise, environment);
      } catch (final Throwable cause) {
        promise.fail(environment.notValid("The OpenAPI specification is not valid.", cause));
      }
      promise.tryComplete(environment);
      return chain;
    });
  }
private static < T extends Environment > Future < T > composeValidation ( final Future < T > future , final BiFunction < Promise < T > , T , Future < T > > validator ) { return future . compose ( environment -> { final Promise < T > promise = Promise . promise ( ) ; var chain = promise . future ( ) ; try { chain = validator . apply ( promise , environment ) ; } catch ( final Throwable cause ) { promise . fail ( environment . notValid ( "The OpenAPI specification is not valid." , cause ) ) ; } promise . tryComplete ( environment ) ; return chain ; } ) ; }
Compose a value validation.
Compose a value validation .