All Downloads are FREE. Search and download functionalities are using the official Maven repository.

x-web-openapi-router.4.5.1.source-code.index.adoc Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR3
Show newest version
= Vert.x OpenAPI Router
:toc: left

Vert.x OpenAPI Router is based on https://vertx.io/docs/vertx-openapi/java/[Vert.x OpenAPI] and only provides the router functionality.

Vert.x OpenAPI Router can:

* generate a router according to your OpenAPI contract, with correct paths & methods.

== Using Vert.x OpenAPI Router

To use Vert.x OpenAPI Router, add the following dependency to the _dependencies_ section of your build descriptor:

* Maven (in your `pom.xml`):

[source,xml,subs="+attributes"]
----

  io.vertx
  vertx-web-openapi-router
  ${maven.version}

----

* Gradle (in your `build.gradle` file):

[source,groovy,subs="+attributes"]
----
dependencies {
  compile 'io.vertx:vertx-web-openapi-router:${maven.version}'
}
----

== RouterBuilder

With the {@link io.vertx.ext.web.openapi.router.RouterBuilder} you can easily generate a Vert.x Web Router based on the passed
{@link io.vertx.openapi.contract.OpenAPIContract}.

[source,$lang]
----
{@link examples.RouterExamples#createRouter}
----

The {@link io.vertx.ext.web.openapi.router.RouterBuilder} provides methods to access the generated routes.
These routes can then be customized by adding custom handlers or enable / disable the validation.

[source,$lang]
----
{@link examples.RouterExamples#modifyRoutes}
----

After a successful validation of the incoming request, the validated parameters and request body are stored in the RoutingContext and can be accessed inside your custom handlers.

[source,$lang]
----
{@link examples.RouterExamples#accessValidatedRequest}
----




© 2015 - 2025 Weber Informatics LLC | Privacy Policy