Class OpenAPI3RouterFactory
- All Implemented Interfaces:
MutinyDelegate
,RouterFactory
To add an handler, use
addHandlerByOperationId(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 -
Constructor Summary
ConstructorsConstructorDescriptionOpenAPI3RouterFactory
(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory delegate) Deprecated.OpenAPI3RouterFactory
(Object delegate) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionaddFailureHandlerByOperationId
(String operationId, Consumer<RoutingContext> failureHandler) Deprecated.addGlobalHandler
(Consumer<RoutingContext> globalHandler) Deprecated.addHandlerByOperationId
(String operationId, Consumer<RoutingContext> handler) Deprecated.addSecurityHandler
(String securitySchemaName, Consumer<RoutingContext> handler) Deprecated.addSecuritySchemaScopeValidator
(String securitySchemaName, String scopeName, Consumer<RoutingContext> handler) Deprecated.static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory>
Deprecated.static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory>
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
Deprecated.io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory
Deprecated.io.vertx.ext.web.api.contract.RouterFactoryOptions
Deprecated.Deprecated.io.vertx.core.Handler<RoutingContext>
Deprecated.Router Factory won't manage the validation errors anymore.int
hashCode()
Deprecated.mountOperationToEventBus
(String operationId, String address) Deprecated.mountServiceFromTag
(String tag, String address) Deprecated.Deprecated.static OpenAPI3RouterFactory
newInstance
(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory arg) Deprecated.setBodyHandler
(BodyHandler bodyHandler) Deprecated.setExtraOperationContextPayloadMapper
(Function<RoutingContext, io.vertx.core.json.JsonObject> extraOperationContextPayloadMapper) Deprecated.setNotImplementedFailureHandler
(Consumer<RoutingContext> notImplementedFailureHandler) Deprecated.You must useRouter.errorHandler(int, Handler)
with 501 errorsetOptions
(io.vertx.ext.web.api.contract.RouterFactoryOptions options) Deprecated.setValidationFailureHandler
(Consumer<RoutingContext> validationFailureHandler) Deprecated.Router Factory won't manage the validation errors anymore.toString()
Deprecated.
-
Field Details
-
__TYPE_ARG
Deprecated.
-
-
Constructor Details
-
OpenAPI3RouterFactory
public OpenAPI3RouterFactory(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory delegate) Deprecated. -
OpenAPI3RouterFactory
Deprecated.
-
-
Method Details
-
getDelegate
public io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory getDelegate()Deprecated.- Specified by:
getDelegate
in interfaceMutinyDelegate
- Specified by:
getDelegate
in interfaceRouterFactory
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
Deprecated. -
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
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.- Specified by:
getOptions
in interfaceRouterFactory
- Returns:
-
getRouter
Deprecated.- Specified by:
getRouter
in interfaceRouterFactory
- Returns:
-
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.- Specified by:
setBodyHandler
in interfaceRouterFactory
- Parameters:
bodyHandler
-- Returns:
- self
-
addGlobalHandler
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.- Parameters:
tag
-address
-- Returns:
- this factory
-
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.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.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) Deprecated.
-