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 invalid
else { 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
original
non 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 OpenAPI3RouterFactory
addFailureHandlerByOperationId(String operationId, Consumer<RoutingContext> failureHandler)
Deprecated.RouterFactory
addGlobalHandler(Consumer<RoutingContext> globalHandler)
Deprecated.OpenAPI3RouterFactory
addHandlerByOperationId(String operationId, Consumer<RoutingContext> handler)
Deprecated.RouterFactory
addSecurityHandler(String securitySchemaName, Consumer<RoutingContext> handler)
Deprecated.OpenAPI3RouterFactory
addSecuritySchemaScopeValidator(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 OpenAPI3RouterFactory
createAndAwait(Vertx vertx, String url)
Deprecated.static OpenAPI3RouterFactory
createAndAwait(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)
Deprecated.static void
createAndForget(Vertx vertx, String url)
Deprecated.static void
createAndForget(Vertx vertx, String url, List<io.vertx.core.json.JsonObject> auth)
Deprecated.boolean
equals(Object o)
io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory
getDelegate()
io.vertx.ext.web.api.contract.RouterFactoryOptions
getOptions()
Deprecated.Router
getRouter()
Deprecated.io.vertx.core.Handler<RoutingContext>
getValidationFailureHandler()
Deprecated.Router Factory won't manage the validation errors anymore.int
hashCode()
OpenAPI3RouterFactory
mountOperationToEventBus(String operationId, String address)
Deprecated.OpenAPI3RouterFactory
mountServiceFromTag(String tag, String address)
Deprecated.OpenAPI3RouterFactory
mountServicesFromExtensions()
Deprecated.static OpenAPI3RouterFactory
newInstance(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory arg)
RouterFactory
setBodyHandler(BodyHandler bodyHandler)
Deprecated.RouterFactory
setExtraOperationContextPayloadMapper(Function<RoutingContext,io.vertx.core.json.JsonObject> extraOperationContextPayloadMapper)
Deprecated.RouterFactory
setNotImplementedFailureHandler(Consumer<RoutingContext> notImplementedFailureHandler)
Deprecated.You must useRouter.errorHandler(int, Handler)
with 501 errorRouterFactory
setOptions(io.vertx.ext.web.api.contract.RouterFactoryOptions options)
Deprecated.RouterFactory
setValidationFailureHandler(Consumer<RoutingContext> validationFailureHandler)
Deprecated.Router Factory won't manage the validation errors anymore.String
toString()
-
-
-
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:
getDelegate
in interfaceRouterFactory
-
addSecurityHandler
@Deprecated public RouterFactory addSecurityHandler(String securitySchemaName, Consumer<RoutingContext> handler)
Deprecated.- Specified by:
addSecurityHandler
in interfaceRouterFactory
- Parameters:
securitySchemaName
-handler
-- Returns:
-
setOptions
@Deprecated public RouterFactory setOptions(io.vertx.ext.web.api.contract.RouterFactoryOptions options)
Deprecated.- Specified by:
setOptions
in interfaceRouterFactory
- Parameters:
options
-- Returns:
-
getOptions
@Deprecated public io.vertx.ext.web.api.contract.RouterFactoryOptions getOptions()
Deprecated.- Specified by:
getOptions
in interfaceRouterFactory
- Returns:
-
getRouter
@Deprecated public Router getRouter()
Deprecated.- Specified by:
getRouter
in 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:
getValidationFailureHandler
in 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:
setValidationFailureHandler
in interfaceRouterFactory
- Parameters:
validationFailureHandler
-- Returns:
-
setNotImplementedFailureHandler
@Deprecated public RouterFactory setNotImplementedFailureHandler(Consumer<RoutingContext> notImplementedFailureHandler)
Deprecated.You must useRouter.errorHandler(int, Handler)
with 501 error- Specified by:
setNotImplementedFailureHandler
in interfaceRouterFactory
- Parameters:
notImplementedFailureHandler
-- Returns:
-
setBodyHandler
@Deprecated public RouterFactory setBodyHandler(BodyHandler bodyHandler)
Deprecated.- Specified by:
setBodyHandler
in interfaceRouterFactory
- Parameters:
bodyHandler
-- Returns:
- self
-
addGlobalHandler
@Deprecated public RouterFactory addGlobalHandler(Consumer<RoutingContext> globalHandler)
Deprecated.- Specified by:
addGlobalHandler
in interfaceRouterFactory
- Parameters:
globalHandler
-- Returns:
-
setExtraOperationContextPayloadMapper
@Deprecated public RouterFactory setExtraOperationContextPayloadMapper(Function<RoutingContext,io.vertx.core.json.JsonObject> extraOperationContextPayloadMapper)
Deprecated.- Specified by:
setExtraOperationContextPayloadMapper
in 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
uni
firing 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
uni
firing 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)
-
-