Removed the file check in createRouterFactoryFromURL. Now it solves also http urls
@@ -115,19 +115,14 @@ public interface OpenAPI3RouterFactory extends DesignDrivenRouterFactory<OpenAPI
vertx.executeBlocking((Future<OpenAPI3RouterFactory> future) -> {
try {
URL urlObj = new URL(url);
- File spec = new File(URLDecoder.decode(urlObj.getFile(), "UTF-8"));
- if (!spec.exists()) {
- future.fail(RouterFactoryException.createSpecNotExistsException(filename));
- } else {
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser().readLocation(spec.getAbsolutePath(), null, null);
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser().readLocation(urlObj.toString(), null, null);
if (swaggerParseResult.getMessages().isEmpty())
future.complete(new OpenAPI3RouterFactoryImpl(vertx, swaggerParseResult.getOpenAPI()));
else {
future.fail(RouterFactoryException.createSpecInvalidException(StringUtils.join(swaggerParseResult.getMessages(), ", ")));
}
- }
} catch (MalformedURLException e) {
- future.fail(RouterFactoryException.createSpecNotExistsException(filename));
+ future.fail(RouterFactoryException.createSpecNotExistsException(url));
}
}, handler);
}
