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, io.vertx.core.Handler<io.vertx.reactivex.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 RX-ified interface using Vert.x codegen.

    • Constructor Detail

      • OpenAPI3RouterFactory

        public OpenAPI3RouterFactory​(Object delegate)
    • Method Detail

      • hashCode

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

        @Deprecated
        public Router getRouter()
        Deprecated.
        Construct a new router based on spec. It will fail if you are trying to mount a spec with security schemes without assigned handlers
        Note: Router is constructed in this function, so it will be respected the path definition ordering.
        Specified by:
        getRouter in interface RouterFactory
        Returns:
      • setNotImplementedFailureHandler

        @Deprecated
        public RouterFactory setNotImplementedFailureHandler​(Handler<RoutingContext> notImplementedFailureHandler)
        Deprecated.
        Set not implemented failure handler. It's called when you don't define an handler for a specific operation. You can enable/disable this feature from
        Specified by:
        setNotImplementedFailureHandler in interface RouterFactory
        Parameters:
        notImplementedFailureHandler -
        Returns:
        this object
      • setBodyHandler

        @Deprecated
        public RouterFactory setBodyHandler​(BodyHandler bodyHandler)
        Deprecated.
        Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded files
        Specified by:
        setBodyHandler in interface RouterFactory
        Parameters:
        bodyHandler -
        Returns:
        self
      • addGlobalHandler

        @Deprecated
        public RouterFactory addGlobalHandler​(Handler<RoutingContext> globalHandler)
        Deprecated.
        Add global handler to be applied prior to Router being generated.
        Please note that you should not add a body handler inside that list. If you want to modify the body handler, please use
        Specified by:
        addGlobalHandler in interface RouterFactory
        Parameters:
        globalHandler -
        Returns:
        this object
      • addSecuritySchemaScopeValidator

        @Deprecated
        public OpenAPI3RouterFactory addSecuritySchemaScopeValidator​(String securitySchemaName,
                                                                     String scopeName,
                                                                     Handler<RoutingContext> handler)
        Deprecated.
        Add a particular scope validator. The main security schema will not be called if a specific scope validator is configured
        Parameters:
        securitySchemaName -
        scopeName -
        handler -
        Returns:
        this factory
      • addFailureHandlerByOperationId

        @Deprecated
        public OpenAPI3RouterFactory addFailureHandlerByOperationId​(String operationId,
                                                                    Handler<RoutingContext> failureHandler)
        Deprecated.
        Add a failure handler by operation_id field in Operation object
        Parameters:
        operationId -
        failureHandler -
        Returns:
        this factory
      • mountOperationToEventBus

        @Deprecated
        public OpenAPI3RouterFactory mountOperationToEventBus​(String operationId,
                                                              String address)
        Deprecated.
        Specify to route an incoming request for specified operation id to a Web Api Service mounted at the specified address on event bus. Please give a look at vertx-web-api-service documentation for more informations
        Parameters:
        operationId -
        address -
        Returns:
        this factory
      • mountServiceFromTag

        @Deprecated
        public OpenAPI3RouterFactory mountServiceFromTag​(String tag,
                                                         String address)
        Deprecated.
        Specify to route an incoming request for all operations that contains the specified tag to a Web Api Service mounted at the specified address on event bus. The request is handled by the method that matches the operation id. Please give a look at vertx-web-api-service documentation for more informations
        Parameters:
        tag -
        address -
        Returns:
        this factory
      • create

        @Deprecated
        public static void create​(Vertx vertx,
                                  String url,
                                  Handler<AsyncResult<OpenAPI3RouterFactory>> handler)
        Deprecated.
        Create a new OpenAPI3RouterFactory
        Parameters:
        vertx -
        url - location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)
        handler - When specification is loaded, this handler will be called with AsyncResult
      • create

        @Deprecated
        public static void create​(Vertx vertx,
                                  String url)
        Deprecated.
        Create a new OpenAPI3RouterFactory
        Parameters:
        vertx -
        url - location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)
      • rxCreate

        @Deprecated
        public static io.reactivex.Single<OpenAPI3RouterFactory> rxCreate​(Vertx vertx,
                                                                          String url)
        Deprecated.
        Create a new OpenAPI3RouterFactory
        Parameters:
        vertx -
        url - location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol)
        Returns:
      • create

        @Deprecated
        public static void create​(Vertx vertx,
                                  String url,
                                  List<JsonObject> auth,
                                  Handler<AsyncResult<OpenAPI3RouterFactory>> handler)
        Deprecated.
        Create a new OpenAPI3RouterFactory
        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
        handler - When specification is loaded, this handler will be called with AsyncResult
      • create

        @Deprecated
        public static void create​(Vertx vertx,
                                  String url,
                                  List<JsonObject> auth)
        Deprecated.
        Create a new OpenAPI3RouterFactory
        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
      • rxCreate

        @Deprecated
        public static io.reactivex.Single<OpenAPI3RouterFactory> rxCreate​(Vertx vertx,
                                                                          String url,
                                                                          List<JsonObject> auth)
        Deprecated.
        Create a new OpenAPI3RouterFactory
        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: