public interface OpenAPI3RouterFactory extends DesignDrivenRouterFactory<io.swagger.oas.models.OpenAPI>
addHandlerByOperationId(String, Handler), in this
class is better than generic DesignDrivenRouterFactory.addHandler(HttpMethod, String, Handler)DesignDrivenRouterFactory.addHandler(HttpMethod, String, Handler) remember that you have to pass path as declared in openapi specification
Usage example:
OpenAPI3RouterFactory.createRouterFactoryFromFile(vertx, "src/resources/spec.yaml", asyncResult -> {
if (!asyncResult.succeeded()) {
// IO failure or spec invalid
} else {
OpenAPI3RouterFactory routerFactory = asyncResult.result();
routerFactory.addHandlerByOperationId("operation_id", routingContext -> {
// Do something
}, routingContext -> {
// Do something with failure handler
});
Router router = routerFactory.getRouter();
}
});
| Modifier and Type | Method and Description |
|---|---|
OpenAPI3RouterFactory |
addFailureHandlerByOperationId(String operationId,
Handler<RoutingContext> failureHandler)
Add a failure handler by operation_id field in Operation object
|
OpenAPI3RouterFactory |
addHandlerByOperationId(String operationId,
Handler<RoutingContext> handler)
Add an handler by operation_id field in Operation object
|
OpenAPI3RouterFactory |
addSecuritySchemaScopeValidator(String securitySchemaName,
String scopeName,
Handler<RoutingContext> handler)
Add a particular scope validator.
|
static void |
createRouterFactoryFromFile(Vertx vertx,
String filename,
Handler<AsyncResult<OpenAPI3RouterFactory>> handler)
Create a new OpenAPI3RouterFactory from a filename
|
static void |
createRouterFactoryFromURL(Vertx vertx,
String url,
Handler<AsyncResult<OpenAPI3RouterFactory>> handler)
Create a new OpenAPI3RouterFactory from an url
|
addFailureHandler, addHandler, addSecurityHandler, enableValidationFailureHandler, getRouter, mountOperationsWithoutHandlers, setValidationFailureHandlerOpenAPI3RouterFactory addSecuritySchemaScopeValidator(String securitySchemaName, String scopeName, Handler<RoutingContext> handler)
securitySchemaName - scopeName - handler - OpenAPI3RouterFactory addHandlerByOperationId(String operationId, Handler<RoutingContext> handler)
operationId - handler - OpenAPI3RouterFactory addFailureHandlerByOperationId(String operationId, Handler<RoutingContext> failureHandler)
operationId - failureHandler - static void createRouterFactoryFromFile(Vertx vertx, String filename, Handler<AsyncResult<OpenAPI3RouterFactory>> handler)
vertx - filename - handler - When specification is loaded, this handler will be called with AsyncResultstatic void createRouterFactoryFromURL(Vertx vertx, String url, Handler<AsyncResult<OpenAPI3RouterFactory>> handler)
vertx - url - handler - When specification is loaded, this handler will be called with AsyncResultCopyright © 2017. All rights reserved.