Class OpenAPI3RouterFactory
- java.lang.Object
-
- io.vertx.mutiny.ext.web.api.contract.openapi3.OpenAPI3RouterFactory
-
- All Implemented Interfaces:
RouterFactory
public class OpenAPI3RouterFactory extends Object implements RouterFactory
Interface for OpenAPI3RouterFactory.
To add an handler, useaddHandlerByOperationId(java.lang.String, java.util.function.Consumer<io.vertx.mutiny.ext.web.RoutingContext>)
Usage example:OpenAPI3RouterFactory.create(vertx, "src/resources/spec.yaml", asyncResult -> { if (!asyncResult.succeeded()) { // IO failure or spec invalidelse { OpenAPI3RouterFactory routerFactory = asyncResult.result(); routerFactory.addHandlerByOperationId("operation_id", routingContext -> { // Do something }, routingContext -> { // Do something with failure handler }); Router router = routerFactory.getRouter(); } }); }
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 Summary
Fields Modifier and Type Field Description static TypeArg<OpenAPI3RouterFactory>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description OpenAPI3RouterFactory(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory delegate)OpenAPI3RouterFactory(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description OpenAPI3RouterFactoryaddFailureHandlerByOperationId(String operationId, Consumer<RoutingContext> failureHandler)Deprecated.RouterFactoryaddGlobalHandler(Consumer<RoutingContext> globalHandler)Deprecated.OpenAPI3RouterFactoryaddHandlerByOperationId(String operationId, Consumer<RoutingContext> handler)Deprecated.RouterFactoryaddSecurityHandler(String securitySchemaName, Consumer<RoutingContext> handler)Deprecated.OpenAPI3RouterFactoryaddSecuritySchemaScopeValidator(String securitySchemaName, String scopeName, Consumer<RoutingContext> handler)Deprecated.static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory>create(Vertx vertx, String url)Deprecated.static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory>create(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)Deprecated.static OpenAPI3RouterFactorycreateAndAwait(Vertx vertx, String url)Deprecated.static OpenAPI3RouterFactorycreateAndAwait(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)Deprecated.static voidcreateAndForget(Vertx vertx, String url)Deprecated.static voidcreateAndForget(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)Deprecated.booleanequals(Object o)io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactorygetDelegate()io.vertx.ext.web.api.contract.RouterFactoryOptionsgetOptions()Deprecated.RoutergetRouter()Deprecated.io.vertx.core.Handler<RoutingContext>getValidationFailureHandler()Deprecated.Router Factory won't manage the validation errors anymore.inthashCode()OpenAPI3RouterFactorymountOperationToEventBus(String operationId, String address)Deprecated.OpenAPI3RouterFactorymountServiceFromTag(String tag, String address)Deprecated.OpenAPI3RouterFactorymountServicesFromExtensions()Deprecated.static OpenAPI3RouterFactorynewInstance(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory arg)RouterFactorysetBodyHandler(BodyHandler bodyHandler)Deprecated.RouterFactorysetExtraOperationContextPayloadMapper(Function<RoutingContext,io.vertx.core.json.JsonObject> extraOperationContextPayloadMapper)Deprecated.RouterFactorysetNotImplementedFailureHandler(Consumer<RoutingContext> notImplementedFailureHandler)Deprecated.You must useRouter.errorHandler(int, Handler)with 501 errorRouterFactorysetOptions(io.vertx.ext.web.api.contract.RouterFactoryOptions options)Deprecated.RouterFactorysetValidationFailureHandler(Consumer<RoutingContext> validationFailureHandler)Deprecated.Router Factory won't manage the validation errors anymore.StringtoString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<OpenAPI3RouterFactory> __TYPE_ARG
-
-
Constructor Detail
-
OpenAPI3RouterFactory
public OpenAPI3RouterFactory(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory delegate)
-
OpenAPI3RouterFactory
public OpenAPI3RouterFactory(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory getDelegate()
- Specified by:
getDelegatein interfaceRouterFactory
-
addSecurityHandler
@Deprecated public RouterFactory addSecurityHandler(String securitySchemaName, Consumer<RoutingContext> handler)
Deprecated.- Specified by:
addSecurityHandlerin interfaceRouterFactory- Parameters:
securitySchemaName-handler-- Returns:
-
setOptions
@Deprecated public RouterFactory setOptions(io.vertx.ext.web.api.contract.RouterFactoryOptions options)
Deprecated.- Specified by:
setOptionsin interfaceRouterFactory- Parameters:
options-- Returns:
-
getOptions
@Deprecated public io.vertx.ext.web.api.contract.RouterFactoryOptions getOptions()
Deprecated.- Specified by:
getOptionsin interfaceRouterFactory- Returns:
-
getRouter
@Deprecated public Router getRouter()
Deprecated.- Specified by:
getRouterin interfaceRouterFactory- Returns:
-
getValidationFailureHandler
@Deprecated public io.vertx.core.Handler<RoutingContext> getValidationFailureHandler()
Deprecated.Router Factory won't manage the validation errors anymore. You must useRouter.errorHandler(int, Handler)with 400 error- Specified by:
getValidationFailureHandlerin interfaceRouterFactory- Returns:
-
setValidationFailureHandler
@Deprecated public RouterFactory setValidationFailureHandler(Consumer<RoutingContext> validationFailureHandler)
Deprecated.Router Factory won't manage the validation errors anymore. You must useRouter.errorHandler(int, Handler)with 400 error- Specified by:
setValidationFailureHandlerin interfaceRouterFactory- Parameters:
validationFailureHandler-- Returns:
-
setNotImplementedFailureHandler
@Deprecated public RouterFactory setNotImplementedFailureHandler(Consumer<RoutingContext> notImplementedFailureHandler)
Deprecated.You must useRouter.errorHandler(int, Handler)with 501 error- Specified by:
setNotImplementedFailureHandlerin interfaceRouterFactory- Parameters:
notImplementedFailureHandler-- Returns:
-
setBodyHandler
@Deprecated public RouterFactory setBodyHandler(BodyHandler bodyHandler)
Deprecated.- Specified by:
setBodyHandlerin interfaceRouterFactory- Parameters:
bodyHandler-- Returns:
- self
-
addGlobalHandler
@Deprecated public RouterFactory addGlobalHandler(Consumer<RoutingContext> globalHandler)
Deprecated.- Specified by:
addGlobalHandlerin interfaceRouterFactory- Parameters:
globalHandler-- Returns:
-
setExtraOperationContextPayloadMapper
@Deprecated public RouterFactory setExtraOperationContextPayloadMapper(Function<RoutingContext,io.vertx.core.json.JsonObject> extraOperationContextPayloadMapper)
Deprecated.- Specified by:
setExtraOperationContextPayloadMapperin interfaceRouterFactory- Parameters:
extraOperationContextPayloadMapper-- Returns:
-
addSecuritySchemaScopeValidator
@Deprecated public OpenAPI3RouterFactory addSecuritySchemaScopeValidator(String securitySchemaName, String scopeName, Consumer<RoutingContext> handler)
Deprecated.- Parameters:
securitySchemaName-scopeName-handler-- Returns:
-
addHandlerByOperationId
@Deprecated public OpenAPI3RouterFactory addHandlerByOperationId(String operationId, Consumer<RoutingContext> handler)
Deprecated.- Parameters:
operationId-handler-- Returns:
-
addFailureHandlerByOperationId
@Deprecated public OpenAPI3RouterFactory addFailureHandlerByOperationId(String operationId, Consumer<RoutingContext> failureHandler)
Deprecated.- Parameters:
operationId-failureHandler-- Returns:
-
mountOperationToEventBus
@Deprecated public OpenAPI3RouterFactory mountOperationToEventBus(String operationId, String address)
Deprecated.- Parameters:
operationId-address-- Returns:
- this factory
-
mountServiceFromTag
@Deprecated public OpenAPI3RouterFactory mountServiceFromTag(String tag, String address)
Deprecated.- Parameters:
tag-address-- Returns:
- this factory
-
mountServicesFromExtensions
@Deprecated public OpenAPI3RouterFactory mountServicesFromExtensions()
Deprecated.- Returns:
- this factory
-
create
@CheckReturnValue @Deprecated public static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory> create(Vertx vertx, String url)
Deprecated.Create a new OpenAPI3RouterFactoryUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx-url- location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
createAndAwait
@Deprecated public static OpenAPI3RouterFactory createAndAwait(Vertx vertx, String url)
Deprecated.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- location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)- Returns:
- the OpenAPI3RouterFactory instance produced by the operation.
-
createAndForget
@Deprecated public static void createAndForget(Vertx vertx, String url)
Deprecated.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- location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)
-
create
@CheckReturnValue @Deprecated public static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory> create(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)
Deprecated.Create a new OpenAPI3RouterFactoryUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx-url- location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)auth- list of authorization values needed to access the remote url. Each item should be json representation of anAuthorizationValue- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
createAndAwait
@Deprecated public static OpenAPI3RouterFactory createAndAwait(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)
Deprecated.Blocking variant ofcreate(io.vertx.mutiny.core.Vertx,String,List).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- location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)auth- list of authorization values needed to access the remote url. Each item should be json representation of anAuthorizationValue- Returns:
- the OpenAPI3RouterFactory instance produced by the operation.
-
createAndForget
@Deprecated public static void createAndForget(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)
Deprecated.Variant ofcreate(io.vertx.mutiny.core.Vertx,String,List)that ignores the result of the operation.This method subscribes on the result of
create(io.vertx.mutiny.core.Vertx,String,List), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromcreate(io.vertx.mutiny.core.Vertx,String,List)but you don't need to compose it with other operations.- Parameters:
vertx-url- location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)auth- list of authorization values needed to access the remote url. Each item should be json representation of anAuthorizationValue
-
newInstance
public static OpenAPI3RouterFactory newInstance(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory arg)
-
-