|
OpenAPI3RouterFactory
|
interface OpenAPI3RouterFactory : RouterFactory<OpenAPI>
Interface for OpenAPI3RouterFactory. To add an handler, use OpenAPI3RouterFactory#addHandlerByOperationId(String, Handler), in this class is better than generic RouterFactory#addHandler(HttpMethod, String, Handler) If you want to use RouterFactory#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(); } });
|