Class OpenAPI3RouterFactory

  • All Implemented Interfaces:
    RouterFactory

    public class OpenAPI3RouterFactory
    extends Object
    implements RouterFactory
    Interface for OpenAPI3RouterFactory.
    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:
    1. Body handler (Customizable with
    2. Custom global handlers configurable with
    3. Global security handlers defined in upper spec level
    4. Operation specific security handlers
    5. Generated validation handler
    6. User handlers or "Not implemented" handler

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • 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 interface RouterFactory
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getOptions

        @Deprecated
        public io.vertx.ext.web.api.contract.RouterFactoryOptions getOptions()
        Deprecated.
        Specified by:
        getOptions in interface RouterFactory
        Returns:
      • getValidationFailureHandler

        @Deprecated
        public io.vertx.core.Handler<RoutingContext> getValidationFailureHandler()
        Deprecated.
        Router Factory won't manage the validation errors anymore. You must use Router.errorHandler(int, Handler) with 400 error
        Specified by:
        getValidationFailureHandler in interface RouterFactory
        Returns:
      • create

        @CheckReturnValue
        @Deprecated
        public static io.smallrye.mutiny.Uni<OpenAPI3RouterFactory> create​(Vertx vertx,
                                                                           String url)
        Deprecated.
        Create a new OpenAPI3RouterFactory

        Unlike 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 of create(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.
      • 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 OpenAPI3RouterFactory

        Unlike 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 an AuthorizationValue
        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 of create(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 an AuthorizationValue
        Returns:
        the OpenAPI3RouterFactory instance produced by the operation.
      • newInstance

        public static OpenAPI3RouterFactory newInstance​(io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory arg)