io.vertx.rxjava.ext.web.api.contract.openapi3

## Class OpenAPI3RouterFactory

- java.lang.Object
- - io.vertx.rxjava.ext.web.api.contract.openapi3.OpenAPI3RouterFactory

- All Implemented Interfaces:
    RouterFactory<io.swagger.v3.oas.models.OpenAPI>

      public class OpenAPI3RouterFactory
      extends Object
      implements RouterFactory<io.swagger.v3.oas.models.OpenAPI>

  Interface for OpenAPI3RouterFactory.
  To add an handler, use `addHandlerByOperationId(java.lang.String, io.vertx.core.Handler<io.vertx.rxjava.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.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static <any>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OpenAPI3RouterFactory(OpenAPI3RouterFactory delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `OpenAPI3RouterFactory` | `addFailureHandlerByOperationId(String operationId, Handler<RoutingContext> failureHandler)` Add a failure handler by operation_id field in Operation object
    `RouterFactory` | `addGlobalHandler(Handler<RoutingContext> globalHandler)` Add global handler to be applied prior to `Router` being generated.
    `OpenAPI3RouterFactory` | `addHandlerByOperationId(String operationId, Handler<RoutingContext> handler)` Add an handler by operation_id field in Operation object
    `RouterFactory` | `addSecurityHandler(String securitySchemaName, Handler<RoutingContext> handler)` Mount to paths that have to follow a security schema a security handler
    `OpenAPI3RouterFactory` | `addSecuritySchemaScopeValidator(String securitySchemaName, String scopeName, Handler<RoutingContext> handler)` Add a particular scope validator.
    `static void` | `create(Vertx vertx, String url, Handler<AsyncResult<OpenAPI3RouterFactory>> handler)` Create a new OpenAPI3RouterFactory
    `static void` | `create(Vertx vertx, String url, List<JsonObject> auth, Handler<AsyncResult<OpenAPI3RouterFactory>> handler)` Create a new OpenAPI3RouterFactory
    `static Observable<OpenAPI3RouterFactory>` | `createObservable(Vertx vertx, String url)` Deprecated. use `rxCreate(io.vertx.rxjava.core.Vertx, java.lang.String)` instead
    `static Observable<OpenAPI3RouterFactory>` | `createObservable(Vertx vertx, String url, List<JsonObject> auth)` Deprecated. use `rxCreate(io.vertx.rxjava.core.Vertx, java.lang.String)` instead
    `boolean` | `equals(Object o)`
    `OpenAPI3RouterFactory` | `getDelegate()`
    `RouterFactoryOptions` | `getOptions()` Get options of router factory.
    `Router` | `getRouter()` Construct a new router based on spec.
    `Handler<RoutingContext>` | `getValidationFailureHandler()`
    `int` | `hashCode()`
    `OpenAPI3RouterFactory` | `mountOperationToEventBus(String operationId, String address)` Specify to route an incoming request for specified operation id to a Web Api Service mounted at the specified address on event bus.
    `OpenAPI3RouterFactory` | `mountServiceFromTag(String tag, String address)` 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.
    `OpenAPI3RouterFactory` | `mountServicesFromExtensions()` Introspect the OpenAPI spec to mount handlers for all operations that specifies a x-vertx-event-bus annotation.
    `static OpenAPI3RouterFactory` | `newInstance(OpenAPI3RouterFactory arg)`
    `static Single<OpenAPI3RouterFactory>` | `rxCreate(Vertx vertx, String url)` Create a new OpenAPI3RouterFactory
    `static Single<OpenAPI3RouterFactory>` | `rxCreate(Vertx vertx, String url, List<JsonObject> auth)` Create a new OpenAPI3RouterFactory
    `RouterFactory` | `setBodyHandler(BodyHandler bodyHandler)` Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded files
    `RouterFactory` | `setExtraOperationContextPayloadMapper(java.util.function.Function<RoutingContext,JsonObject> extraOperationContextPayloadMapper)` When set, this function is called while creating the payload of `OperationRequest`
    `RouterFactory` | `setNotImplementedFailureHandler(Handler<RoutingContext> notImplementedFailureHandler)` Set not implemented failure handler.
    `RouterFactory` | `setOptions(RouterFactoryOptions options)` Set options of router factory.
    `RouterFactory` | `setValidationFailureHandler(Handler<RoutingContext> validationFailureHandler)` Set default validation failure handler.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.rxjava.ext.web.api.contract.RouterFactory

      `newInstance, newInstance`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final <any> __TYPE_ARG

  - ### Constructor Detail

    - #### OpenAPI3RouterFactory

          public OpenAPI3RouterFactory(OpenAPI3RouterFactory delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public OpenAPI3RouterFactory getDelegate()

      Specified by:
        `getDelegate` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`

    - #### addSecurityHandler

          public RouterFactory addSecurityHandler(String securitySchemaName,
                                                  Handler<RoutingContext> handler)

      Mount to paths that have to follow a security schema a security handler
      Specified by:
        `addSecurityHandler` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `securitySchemaName` -
        `handler` -
      Returns:

    - #### setOptions

          public RouterFactory setOptions(RouterFactoryOptions options)

      Set options of router factory. For more info
      Specified by:
        `setOptions` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `options` -
      Returns:

    - #### getOptions

          public RouterFactoryOptions getOptions()

      Get options of router factory. For more info
      Specified by:
        `getOptions` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`
      Returns:

    - #### getRouter

          public Router getRouter()

      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<io.swagger.v3.oas.models.OpenAPI>`
      Returns:

    - #### getValidationFailureHandler

          public Handler<RoutingContext> getValidationFailureHandler()

      Specified by:
        `getValidationFailureHandler` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`

    - #### setValidationFailureHandler

          public RouterFactory setValidationFailureHandler(Handler<RoutingContext> validationFailureHandler)

      Set default validation failure handler. You can enable/disable this feature from
      Specified by:
        `setValidationFailureHandler` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `validationFailureHandler` -
      Returns:
        this object

    - #### setNotImplementedFailureHandler

          public RouterFactory setNotImplementedFailureHandler(Handler<RoutingContext> notImplementedFailureHandler)

      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<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `notImplementedFailureHandler` -
      Returns:
        this object

    - #### setBodyHandler

          public RouterFactory setBodyHandler(BodyHandler bodyHandler)

      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<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `bodyHandler` -
      Returns:
        self

    - #### addGlobalHandler

          public RouterFactory addGlobalHandler(Handler<RoutingContext> globalHandler)

      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<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `globalHandler` -
      Returns:
        this object

    - #### setExtraOperationContextPayloadMapper

          public RouterFactory setExtraOperationContextPayloadMapper(java.util.function.Function<RoutingContext,JsonObject> extraOperationContextPayloadMapper)

      When set, this function is called while creating the payload of `OperationRequest`
      Specified by:
        `setExtraOperationContextPayloadMapper` in interface `RouterFactory<io.swagger.v3.oas.models.OpenAPI>`
      Parameters:
        `extraOperationContextPayloadMapper` -
      Returns:

    - #### addSecuritySchemaScopeValidator

          public OpenAPI3RouterFactory addSecuritySchemaScopeValidator(String securitySchemaName,
                                                                       String scopeName,
                                                                       Handler<RoutingContext> handler)

      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

    - #### addHandlerByOperationId

          public OpenAPI3RouterFactory addHandlerByOperationId(String operationId,
                                                               Handler<RoutingContext> handler)

      Add an handler by operation_id field in Operation object
      Parameters:
        `operationId` -
        `handler` -
      Returns:
        this factory

    - #### addFailureHandlerByOperationId

          public OpenAPI3RouterFactory addFailureHandlerByOperationId(String operationId,
                                                                      Handler<RoutingContext> failureHandler)

      Add a failure handler by operation_id field in Operation object
      Parameters:
        `operationId` -
        `failureHandler` -
      Returns:
        this factory

    - #### mountOperationToEventBus

          public OpenAPI3RouterFactory mountOperationToEventBus(String operationId,
                                                                String address)

      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

          public OpenAPI3RouterFactory mountServiceFromTag(String tag,
                                                           String address)

      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

    - #### mountServicesFromExtensions

          public OpenAPI3RouterFactory mountServicesFromExtensions()

      Introspect the OpenAPI spec to mount handlers for all operations that specifies a x-vertx-event-bus annotation. Please give a look at vertx-web-api-service documentation for more informations
      Returns:
        this factory

    - #### create

          public static void create(Vertx vertx,
                                    String url,
                                    Handler<AsyncResult<OpenAPI3RouterFactory>> handler)

      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

    - #### createObservable

          @Deprecated
          public static Observable<OpenAPI3RouterFactory> createObservable(Vertx vertx,
                                                                                       String url)

      Deprecated. use `rxCreate(io.vertx.rxjava.core.Vertx, java.lang.String)` instead
      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:

    - #### rxCreate

          public static Single<OpenAPI3RouterFactory> rxCreate(Vertx vertx,
                                                               String url)

      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

          public static void create(Vertx vertx,
                                    String url,
                                    List<JsonObject> auth,
                                    Handler<AsyncResult<OpenAPI3RouterFactory>> handler)

      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
        `handler` - When specification is loaded, this handler will be called with AsyncResult

    - #### createObservable

          @Deprecated
          public static Observable<OpenAPI3RouterFactory> createObservable(Vertx vertx,
                                                                                       String url,
                                                                                       List<JsonObject> auth)

      Deprecated. use `rxCreate(io.vertx.rxjava.core.Vertx, java.lang.String)` instead
      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
      Returns:

    - #### rxCreate

          public static Single<OpenAPI3RouterFactory> rxCreate(Vertx vertx,
                                                               String url,
                                                               List<JsonObject> auth)

      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
      Returns:

    - #### newInstance

          public static OpenAPI3RouterFactory newInstance(OpenAPI3RouterFactory arg)

Copyright © 2018 Eclipse. All rights reserved.