io.vertx.rxjava3.ext.web.openapi

## Class RouterBuilder

- java.lang.Object
- - io.vertx.rxjava3.ext.web.openapi.RouterBuilder

-     public class RouterBuilder
      extends Object

  Interface to build a Vert.x Web from an OpenAPI 3 contract.
  To add an handler, use `operation(java.lang.String)` (String, Handler)}
  Usage example:

       RouterBuilder.create(vertx, "src/resources/spec.yaml", asyncResult -> {
        if (!asyncResult.succeeded()) {
           // IO failure or spec invalid else {
           RouterBuilder routerBuilder = asyncResult.result();
           RouterBuilder.operation("operation_id").handler(routingContext -> {
              // Do something
           }, routingContext -> {
              // Do something with failure handler
           });
           Router router = routerBuilder.createRouter();
        }
       });
       }

  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 io.vertx.lang.rx.TypeArg<RouterBuilder>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RouterBuilder(Object delegate)`
    `RouterBuilder(RouterBuilder delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `RouterBuilder` | `bodyHandler(BodyHandler bodyHandler)` Deprecated.
    `static Single<RouterBuilder>` | `create(Vertx vertx, String url)` Like
    `static Single<RouterBuilder>` | `create(Vertx vertx, String url, OpenAPILoaderOptions options)` Like
    `Router` | `createRouter()` Construct a new router based on spec.
    `boolean` | `equals(Object o)`
    `RouterBuilder` | `getDelegate()`
    `OpenAPIHolder` | `getOpenAPI()`
    `RouterBuilderOptions` | `getOptions()`
    `SchemaParser` | `getSchemaParser()` Deprecated.
    `SchemaRouter` | `getSchemaRouter()` Deprecated.
    `int` | `hashCode()`
    `RouterBuilder` | `mountServicesFromExtensions()` Introspect the OpenAPI spec to mount handlers for all operations that specifies a x-vertx-event-bus annotation.
    `static RouterBuilder` | `newInstance(RouterBuilder arg)`
    `Operation` | `operation(String operationId)` Access to an operation defined in the contract with `operationId`
    `List<Operation>` | `operations()`
    `RouterBuilder` | `rootHandler(Handler<RoutingContext> rootHandler)` Add global handler to be applied prior to being generated.
    `static Single<RouterBuilder>` | `rxCreate(Vertx vertx, String url)` Like
    `static Single<RouterBuilder>` | `rxCreate(Vertx vertx, String url, OpenAPILoaderOptions options)` Like
    `SecurityScheme` | `securityHandler(String securitySchemeName)` Creates a new security scheme for the required .
    `RouterBuilder` | `securityHandler(String securitySchemeName, AuthenticationHandler handler)` Mount to paths that have to follow a security schema a security handler.
    `RouterBuilder` | `serviceExtraPayloadMapper(java.util.function.Function<RoutingContext,JsonObject> serviceExtraPayloadMapper)` When set, this function is called while creating the payload of
    `RouterBuilder` | `setOptions(RouterBuilderOptions options)` Set options of router builder.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<RouterBuilder> __TYPE_ARG

  - ### Constructor Detail

    - #### RouterBuilder

          public RouterBuilder(RouterBuilder delegate)

    - #### RouterBuilder

          public RouterBuilder(Object 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 RouterBuilder getDelegate()

    - #### operation

          public Operation operation(String operationId)

      Access to an operation defined in the contract with `operationId`
      Parameters:
        `operationId` - the id of the operation
      Returns:
        the requested operation

    - #### operations

          public List<Operation> operations()

      Returns:
        all operations defined in the contract

    - #### bodyHandler

          @Deprecated
          public RouterBuilder bodyHandler(BodyHandler bodyHandler)

      Deprecated.
      Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded files. If you provide a null body handler, you won't be able to validate request bodies
      Parameters:
        `bodyHandler` -
      Returns:
        self

    - #### rootHandler

          public RouterBuilder rootHandler(Handler<RoutingContext> rootHandler)

      Add global handler to be applied prior to 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 `bodyHandler(io.vertx.rxjava3.ext.web.handler.BodyHandler)`
      Parameters:
        `rootHandler` -
      Returns:
        self

    - #### mountServicesFromExtensions

          public RouterBuilder 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:
        self

    - #### setOptions

          public RouterBuilder setOptions(RouterBuilderOptions options)

      Set options of router builder. For more info `RouterBuilderOptions`
      Parameters:
        `options` -
      Returns:
        self

    - #### getOptions

          public RouterBuilderOptions getOptions()

      Returns:
        options of router builder. For more info `RouterBuilderOptions`

    - #### getOpenAPI

          public OpenAPIHolder getOpenAPI()

      Returns:
        holder used by self to process the OpenAPI. You can use it to resolve `$ref`s

    - #### getSchemaRouter

          @Deprecated
          public SchemaRouter getSchemaRouter()

      Deprecated.
      Returns:
        schema router used by self to internally manage all `Schema` instances

    - #### getSchemaParser

          @Deprecated
          public SchemaParser getSchemaParser()

      Deprecated.
      Returns:
        schema parser used by self to parse all `Schema`

    - #### serviceExtraPayloadMapper

          public RouterBuilder serviceExtraPayloadMapper(java.util.function.Function<RoutingContext,JsonObject> serviceExtraPayloadMapper)

      When set, this function is called while creating the payload of
      Parameters:
        `serviceExtraPayloadMapper` -
      Returns:
        self

    - #### securityHandler

          public SecurityScheme securityHandler(String securitySchemeName)

      Creates a new security scheme for the required .
      Parameters:
        `securitySchemeName` -
      Returns:
        a security scheme.

    - #### createRouter

          public Router createRouter()

      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 built when this function is called and the path definition ordering in contract is respected.
      Returns:

    - #### create

          public static Single<RouterBuilder> create(Vertx vertx,
                                                     String url)

      Like
      Parameters:
        `vertx` -
        `url` -
      Returns:

    - #### rxCreate

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

      Like
      Parameters:
        `vertx` -
        `url` -
      Returns:

    - #### create

          public static Single<RouterBuilder> create(Vertx vertx,
                                                     String url,
                                                     OpenAPILoaderOptions options)

      Like
      Parameters:
        `vertx` -
        `url` -
        `options` -
      Returns:

    - #### rxCreate

          public static Single<RouterBuilder> rxCreate(Vertx vertx,
                                                       String url,
                                                       OpenAPILoaderOptions options)

      Like
      Parameters:
        `vertx` -
        `url` -
        `options` -
      Returns:

    - #### securityHandler

          public RouterBuilder securityHandler(String securitySchemeName,
                                               AuthenticationHandler handler)

      Mount to paths that have to follow a security schema a security handler. This method will not perform any validation weather or not the given `securitySchemeName` is present in the OpenAPI document. For must use cases the method `securityHandler(java.lang.String)` should be used.
      Parameters:
        `securitySchemeName` - the components security scheme id
        `handler` - the authentication handler
      Returns:
        self

    - #### newInstance

          public static RouterBuilder newInstance(RouterBuilder arg)

Copyright © 2024 Eclipse. All rights reserved.