Class RouterBuilder
- java.lang.Object
- 
- io.vertx.mutiny.ext.web.openapi.RouterBuilder
 
- 
 public class RouterBuilder extends Object Interface to build a Vert.x Web from an OpenAPI 3 contract.
 To add an handler, useoperation(java.lang.String)(String, Handler)}
 Usage example:RouterBuilder.create(vertx, "src/resources/spec.yaml", asyncResult -> { if (!asyncResult.succeeded()) { // IO failure or spec invalidelse { RouterBuilder routerBuilder = asyncResult.result(); RouterBuilder.operation("operation_id").handler(routingContext -> { // Do something }, routingContext -> { // Do something with failure handler }); Router router = routerBuilder.createRouter(); } }); }
 Handlers are loaded in this order:
 - Body handler (Customizable with
- Custom global handlers configurable with
- Global security handlers defined in upper spec level
- Operation specific security handlers
- Generated validation handler
- User handlers or "Not implemented" handler
 originalnon Mutiny-ified interface using Vert.x codegen.
- 
- 
Field SummaryFields Modifier and Type Field Description static TypeArg<RouterBuilder>__TYPE_ARG
 - 
Constructor SummaryConstructors Constructor Description RouterBuilder(io.vertx.ext.web.openapi.RouterBuilder delegate)RouterBuilder(Object delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RouterBuilderbodyHandler(BodyHandler bodyHandler)Deprecated.Use#rootHandler(Handler)instead.static io.smallrye.mutiny.Uni<RouterBuilder>create(Vertx vertx, String url)Likestatic io.smallrye.mutiny.Uni<RouterBuilder>create(Vertx vertx, String url, io.vertx.ext.web.openapi.OpenAPILoaderOptions options)Likestatic RouterBuildercreateAndAwait(Vertx vertx, String url)Blocking variant ofcreate(io.vertx.mutiny.core.Vertx,String).static RouterBuildercreateAndAwait(Vertx vertx, String url, io.vertx.ext.web.openapi.OpenAPILoaderOptions options)Blocking variant ofcreate(io.vertx.mutiny.core.Vertx,String,OpenAPILoaderOptions).static voidcreateAndForget(Vertx vertx, String url)Variant ofcreate(io.vertx.mutiny.core.Vertx,String)that ignores the result of the operation.static voidcreateAndForget(Vertx vertx, String url, io.vertx.ext.web.openapi.OpenAPILoaderOptions options)Variant ofcreate(io.vertx.mutiny.core.Vertx,String,OpenAPILoaderOptions)that ignores the result of the operation.RoutercreateRouter()booleanequals(Object o)io.vertx.ext.web.openapi.RouterBuildergetDelegate()OpenAPIHoldergetOpenAPI()io.vertx.ext.web.openapi.RouterBuilderOptionsgetOptions()SchemaParsergetSchemaParser()Deprecated.This method exposes the internal of the OpenAPI handler, it will be removed in the future.SchemaRoutergetSchemaRouter()Deprecated.This method exposes the internal of the OpenAPI handler, it will be removed in the future.inthashCode()RouterBuildermountServicesFromExtensions()static RouterBuildernewInstance(io.vertx.ext.web.openapi.RouterBuilder arg)Operationoperation(String operationId)List<Operation>operations()RouterBuilderrootHandler(Consumer<RoutingContext> rootHandler)SecuritySchemesecurityHandler(String securitySchemeName)RouterBuildersecurityHandler(String securitySchemeName, AuthenticationHandler handler)RouterBuilderserviceExtraPayloadMapper(Function<RoutingContext,io.vertx.core.json.JsonObject> serviceExtraPayloadMapper)RouterBuildersetOptions(io.vertx.ext.web.openapi.RouterBuilderOptions options)StringtoString()
 
- 
- 
- 
Field Detail- 
__TYPE_ARGpublic static final TypeArg<RouterBuilder> __TYPE_ARG 
 
- 
 - 
Constructor Detail- 
RouterBuilderpublic RouterBuilder(io.vertx.ext.web.openapi.RouterBuilder delegate) 
 - 
RouterBuilderpublic RouterBuilder(Object delegate) 
 
- 
 - 
Method Detail- 
getDelegatepublic io.vertx.ext.web.openapi.RouterBuilder getDelegate() 
 - 
operationpublic Operation operation(String operationId) - Parameters:
- operationId- the id of the operation
- Returns:
- the requested operation
 
 - 
bodyHandler@Deprecated public RouterBuilder bodyHandler(BodyHandler bodyHandler) Deprecated.Use#rootHandler(Handler)instead. The order matters, so adding the body handler should happen after anyPLATFORMorSECURITY_POLICYhandler(s).- Parameters:
- bodyHandler-
- Returns:
- self
 
 - 
rootHandlerpublic RouterBuilder rootHandler(Consumer<RoutingContext> rootHandler) - Parameters:
- rootHandler-
- Returns:
 
 - 
mountServicesFromExtensionspublic RouterBuilder mountServicesFromExtensions() - Returns:
- self
 
 - 
setOptionspublic RouterBuilder setOptions(io.vertx.ext.web.openapi.RouterBuilderOptions options) - Parameters:
- options-
- Returns:
- self
 
 - 
getOptionspublic io.vertx.ext.web.openapi.RouterBuilderOptions getOptions() - Returns:
- options of router builder. For more info RouterBuilderOptions
 
 - 
getOpenAPIpublic OpenAPIHolder getOpenAPI() - Returns:
- holder used by self to process the OpenAPI. You can use it to resolve $refs
 
 - 
getSchemaRouter@Deprecated public SchemaRouter getSchemaRouter() Deprecated.This method exposes the internal of the OpenAPI handler, it will be removed in the future. Users should configure the json schema module from the options.- Returns:
- schema router used by self to internally manage all Schemainstances
 
 - 
getSchemaParser@Deprecated public SchemaParser getSchemaParser() Deprecated.This method exposes the internal of the OpenAPI handler, it will be removed in the future. Users should configure the json schema module from the options.- Returns:
- schema parser used by self to parse all Schema
 
 - 
serviceExtraPayloadMapperpublic RouterBuilder serviceExtraPayloadMapper(Function<RoutingContext,io.vertx.core.json.JsonObject> serviceExtraPayloadMapper) - Parameters:
- serviceExtraPayloadMapper-
- Returns:
- self
 
 - 
securityHandlerpublic SecurityScheme securityHandler(String securitySchemeName) - Parameters:
- securitySchemeName-
- Returns:
- a security scheme.
 
 - 
createRouterpublic Router createRouter() - Returns:
 
 - 
create@CheckReturnValue public static io.smallrye.mutiny.Uni<RouterBuilder> create(Vertx vertx, String url) LikeUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- vertx-
- url-
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
createAndAwaitpublic static RouterBuilder createAndAwait(Vertx vertx, String url) Blocking variant ofcreate(io.vertx.mutiny.core.Vertx,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- vertx-
- url-
- Returns:
- the RouterBuilder instance produced by the operation.
 
 - 
createAndForgetpublic static void createAndForget(Vertx vertx, String url) Variant ofcreate(io.vertx.mutiny.core.Vertx,String)that ignores the result of the operation.This method subscribes on the result of create(io.vertx.mutiny.core.Vertx,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromcreate(io.vertx.mutiny.core.Vertx,String)but you don't need to compose it with other operations.- Parameters:
- vertx-
- url-
 
 - 
create@CheckReturnValue public static io.smallrye.mutiny.Uni<RouterBuilder> create(Vertx vertx, String url, io.vertx.ext.web.openapi.OpenAPILoaderOptions options) LikeUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- vertx-
- url-
- options-
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
createAndAwaitpublic static RouterBuilder createAndAwait(Vertx vertx, String url, io.vertx.ext.web.openapi.OpenAPILoaderOptions options) Blocking variant ofcreate(io.vertx.mutiny.core.Vertx,String,OpenAPILoaderOptions).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- vertx-
- url-
- options-
- Returns:
- the RouterBuilder instance produced by the operation.
 
 - 
createAndForgetpublic static void createAndForget(Vertx vertx, String url, io.vertx.ext.web.openapi.OpenAPILoaderOptions options) Variant ofcreate(io.vertx.mutiny.core.Vertx,String,OpenAPILoaderOptions)that ignores the result of the operation.This method subscribes on the result of create(io.vertx.mutiny.core.Vertx,String,OpenAPILoaderOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromcreate(io.vertx.mutiny.core.Vertx,String,OpenAPILoaderOptions)but you don't need to compose it with other operations.- Parameters:
- vertx-
- url-
- options-
 
 - 
securityHandlerpublic RouterBuilder securityHandler(String securitySchemeName, AuthenticationHandler handler) - Parameters:
- securitySchemeName- the components security scheme id
- handler- the authentication handler
- Returns:
- self
 
 - 
newInstancepublic static RouterBuilder newInstance(io.vertx.ext.web.openapi.RouterBuilder arg) 
 
- 
 
-