vertx/src/main/java/eu/internetofus/common/vertx/OpenAPIValidator.java
/**
   * Validate that the value has the required properties.
   *
   * @param promise     to inform of the validation.
   * @param environment to use for the validation.
   *
   * @return the future that says if the value is valid or not.
   */
Validate that the value has the required properties.
@param promise     to inform of the validation.
@param environment to use for the validation.

@return the future that says if the value is valid or not.
Validate that the value has the required properties . @param promise to inform of the validation . @param environment to use for the validation . @return the future that says if the value is valid or not .
static Future<ValueEnvironment> validateValue(@NotNull final Promise<ValueEnvironment> promise,
      @NotNull final ValueEnvironment environment) {
    var future = promise.future();
    if (!environment.specification.isEmpty()) {
      if (environment.value == null) {
        if (environment.specification.containsKey("default")) {
          final var defaultValue = environment.specification.getString("default");
          environment.value = Json.decodeValue(defaultValue);
          if (environment.value != null) {
            return validateValue(promise, environment);
          }
        }
        if (!environment.specification.getBoolean("nullable", false)) {
          promise.fail(environment.notValid("Not allowed a 'null' value."));
        } else {
          environment.match = true;
        }
      } else {
        if (environment.specification.containsKey("oneOf")) {
          future = composeValidation(future, OpenAPIValidator::validateOneOfValue);
        }
        if (environment.specification.containsKey("anyOf")) {
          future = composeValidation(future, OpenAPIValidator::validateAnyOfValue);
        }
        if (environment.specification.containsKey("allOf")) {
          future = composeValidation(future, OpenAPIValidator::validateAllOfValue);
        }
        if (environment.specification.containsKey("not")) {
          future = composeValidation(future, OpenAPIValidator::validateNotValue);
        }
        if (environment.specification.containsKey("$ref")) {
          future = composeValidation(future, OpenAPIValidator::validateRefValue);
        }
        if (environment.specification.containsKey("type")) {
          future = composeValidation(future, OpenAPIValidator::validateTypeValue);
        }
        if (environment.specification.containsKey("enum")) {
          future = composeValidation(future, OpenAPIValidator::validateEnumValue);
        }
        if (environment.specification.containsKey("required")) {
          future = composeValidation(future, OpenAPIValidator::validateRequiredValue);
        }
        if (!environment.checkingCompose) {
          future = composeValidation(future, OpenAPIValidator::validateUndefinedFieldsInValue);
        }
      }
    } 
    return future;
  }
static Future < ValueEnvironment > validateValue ( @ NotNull final Promise < ValueEnvironment > promise , @ NotNull final ValueEnvironment environment ) { var future = promise . future ( ) ; if ( ! environment . specification . isEmpty ( ) ) { if ( environment . value == null ) { if ( environment . specification . containsKey ( "default" ) ) { final var defaultValue = environment . specification . getString ( "default" ) ; environment . value = Json . decodeValue ( defaultValue ) ; if ( environment . value != null ) { return validateValue ( promise , environment ) ; } } if ( ! environment . specification . getBoolean ( "nullable" , false ) ) { promise . fail ( environment . notValid ( "Not allowed a 'null' value." ) ) ; } else { environment . match = true ; } } else { if ( environment . specification . containsKey ( "oneOf" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateOneOfValue ) ; } if ( environment . specification . containsKey ( "anyOf" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateAnyOfValue ) ; } if ( environment . specification . containsKey ( "allOf" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateAllOfValue ) ; } if ( environment . specification . containsKey ( "not" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateNotValue ) ; } if ( environment . specification . containsKey ( "$ref" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateRefValue ) ; } if ( environment . specification . containsKey ( "type" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateTypeValue ) ; } if ( environment . specification . containsKey ( "enum" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateEnumValue ) ; } if ( environment . specification . containsKey ( "required" ) ) { future = composeValidation ( future , OpenAPIValidator :: validateRequiredValue ) ; } if ( ! environment . checkingCompose ) { future = composeValidation ( future , OpenAPIValidator :: validateUndefinedFieldsInValue ) ; } } } return future ; }
Validate that the value has the required properties.
Validate that the value has the required properties .
// else accept any value