io.vertx.ext.web.openapi.router

## Interface RouterBuilder

-     public interface RouterBuilder

  Interface to build a Vert.x Web `Router` from an OpenAPI 3 contract.

  The router is mounting its handlers in the following order:
  1. RootHandler
  in the order the root handlers were added to the RouterBuilder.
  2. ValidationHandler
  This handler is implementing the marker interface `InputTrustHandler`. Because of this, all handlers of type PLATFORM, SECURITY_POLICY, BODY and AUTHENTICATION must be mounted as root handlers if required.
  3. UserHandler
  The custom user handlers defined in the `OpenAPIRoute` in the same order as they are added to the route.
  4. FailureHandler
  The failure handlers defined in the `OpenAPIRoute` in the same order as they are added to the route.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `KEY_META_DATA_OPERATION`
    `static String` | `KEY_META_DATA_VALIDATED_REQUEST`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RouterBuilder` | `create(Vertx vertx, OpenAPIContract contract)` Create a new `RouterBuilder`.
    `static RouterBuilder` | `create(Vertx vertx, OpenAPIContract contract, RequestExtractor extractor)` Create a new `RouterBuilder`.
    `Router` | `createRouter()` Construct a new router based on the related OpenAPI contract.
    `OpenAPIRoute` | `getRoute(String operationId)` Access to a route defined in the contract with `operationId`
    `List<OpenAPIRoute>` | `getRoutes()`
    `RouterBuilder` | `rootHandler(Handler<RoutingContext> rootHandler)` Add global handler to be applied prior to `Router` being generated.

- - ### Field Detail

    - #### KEY_META_DATA_OPERATION

          static final String KEY_META_DATA_OPERATION

      See Also:
        Constant Field Values

    - #### KEY_META_DATA_VALIDATED_REQUEST

          static final String KEY_META_DATA_VALIDATED_REQUEST

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          static RouterBuilder create(Vertx vertx,
                                      OpenAPIContract contract)

      Create a new `RouterBuilder`. Like `create(Vertx, OpenAPIContract, RequestExtractor)` but uses a default implementation for the extractor.
      Parameters:
        `vertx` - the related Vert.x instance
        `contract` - the contract that describes the endpoint
      Returns:
        an instance of `RouterBuilder`

    - #### create

          static RouterBuilder create(Vertx vertx,
                                      OpenAPIContract contract,
                                      RequestExtractor extractor)

      Create a new `RouterBuilder`.
      Parameters:
        `vertx` - the related Vert.x instance
        `contract` - the contract that describes the endpoint
        `extractor` - the extractor is used to extract and transform the parameters and body of the related request in a format that can be validated by the `RequestValidator`.
      Returns:
        an instance of `RouterBuilder`

    - #### getRoute

          OpenAPIRoute getRoute(String operationId)

      Access to a route defined in the contract with `operationId`
      Parameters:
        `operationId` - the id of the operation
      Returns:
        the requested route, or null if the passed operationId doesn't exist.

    - #### getRoutes

          List<OpenAPIRoute> getRoutes()

      Returns:
        all routes defined in the contract

    - #### rootHandler

          RouterBuilder rootHandler(Handler<RoutingContext> rootHandler)

      Add global handler to be applied prior to `Router` being generated.
      Parameters:
        `rootHandler` - the root handler to add
      Returns:
        self

    - #### createRouter

          Router createRouter()

      Construct a new router based on the related OpenAPI contract.
      Returns:
        a Router based on the related OpenAPI contract.

Copyright © 2023 Eclipse. All rights reserved.