vertx/src/main/java/eu/internetofus/common/vertx/OpenAPIValidator.java
/**
     * Load the json define on the specified path.
     *
     * @param remote path/URL to the remote resource.
     *
     * @return the future with the remote resource.
     */
Load the json define on the specified path.
@param remote path/URL to the remote resource.

@return the future with the remote resource.
Load the json define on the specified path . @param remote path / URL to the remote resource . @return the future with the remote resource .
private Future<JsonObject> load(final String remote) {
      return this.vertx.executeBlocking(promise -> {
        try {
          final var url = new URL(remote);
          var content = IOUtils.toString(url.openStream(), Charset.defaultCharset());
          if (!url.getPath().endsWith(".json")) {
            final var mapper = new YAMLMapper();
            final var root = mapper.readTree(url.openStream());
            content = root.toString();
          }
          final var json = new JsonObject(content);
          promise.complete(json);
        } catch (final Throwable cause) {
          promise.fail(this.notValid("$ref", "Cannot obtain the reference.", cause));
        }
      });
    }
private Future < JsonObject > load ( final String remote ) { return this . vertx . executeBlocking ( promise -> { try { final var url = new URL ( remote ) ; var content = IOUtils . toString ( url . openStream ( ) , Charset . defaultCharset ( ) ) ; if ( ! url . getPath ( ) . endsWith ( ".json" ) ) { final var mapper = new YAMLMapper ( ) ; final var root = mapper . readTree ( url . openStream ( ) ) ; content = root . toString ( ) ; } final var json = new JsonObject ( content ) ; promise . complete ( json ) ; } catch ( final Throwable cause ) { promise . fail ( this . notValid ( "$ref" , "Cannot obtain the reference." , cause ) ) ; } } ) ; }
Load the json define on the specified path.
Load the json define on the specified path .