Skip to content

Commit

Permalink
Bumped Vert.x template to Vert.x 4 GA (#8528)
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
  • Loading branch information
slinkydeveloper authored Jan 27, 2021
1 parent b203539 commit 0b2aa21
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package {{package}};

import com.fasterxml.jackson.core.type.TypeReference;
import io.vertx.core.json.jackson.DatabindCodec;
import io.vertx.ext.web.openapi.RouterFactory;
import io.vertx.ext.web.openapi.RouterBuilder;
import io.vertx.ext.web.validation.RequestParameters;
import io.vertx.ext.web.validation.RequestParameter;
import io.vertx.ext.web.validation.ValidationHandler;
Expand All @@ -27,10 +27,10 @@ public class {{classname}}Handler {
this.apiImpl = new {{classname}}Impl();
}

public void mount(RouterFactory factory) {
public void mount(RouterBuilder builder) {
{{#operations}}
{{#operation}}
factory.operation("{{operationId}}").handler(this::{{operationId}});
builder.operation("{{operationId}}").handler(this::{{operationId}});
{{/operation}}
{{/operations}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import io.vertx.core.Promise;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.openapi.RouterFactory;
import io.vertx.ext.web.openapi.RouterFactoryOptions;
import io.vertx.ext.web.openapi.RouterBuilder;
import io.vertx.ext.web.openapi.RouterBuilderOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
{{#apiInfo}}{{#apis}}
Expand All @@ -22,16 +22,16 @@ public class HttpServerVerticle extends AbstractVerticle {

@Override
public void start(Promise<Void> startPromise) {
RouterFactory.create(vertx, specFile)
.map(factory -> {
factory.setOptions(new RouterFactoryOptions()
RouterBuilder.create(vertx, specFile)
.map(builder -> {
builder.setOptions(new RouterBuilderOptions()
// For production use case, you need to enable this flag and provide the proper security handler
.setRequireSecurityHandlers(false)
);
{{#apiInfo}}{{#apis}}
{{classVarName}}Handler.mount(factory);{{/apis}}{{/apiInfo}}
{{classVarName}}Handler.mount(builder);{{/apis}}{{/apiInfo}}

Router router = factory.createRouter();
Router router = builder.createRouter();
router.errorHandler(400, this::validationFailureHandler);

return router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<exec-maven-plugin.version>1.5.0</exec-maven-plugin.version>

<vertx.version>4.0.0.Beta3</vertx.version>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
<vertx.version>4.0.0</vertx.version>
<junit-jupiter.version>5.7.0</junit-jupiter.version>
<slf4j.version>1.7.30</slf4j.version>
<jackson.version>2.11.2</jackson.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ src/main/java/org/openapitools/vertxweb/server/api/UserApi.java
src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java
src/main/java/org/openapitools/vertxweb/server/api/UserApiImpl.java
src/main/java/org/openapitools/vertxweb/server/model/Category.java
src/main/java/org/openapitools/vertxweb/server/model/InlineObject.java
src/main/java/org/openapitools/vertxweb/server/model/InlineObject1.java
src/main/java/org/openapitools/vertxweb/server/model/ModelApiResponse.java
src/main/java/org/openapitools/vertxweb/server/model/Order.java
src/main/java/org/openapitools/vertxweb/server/model/Pet.java
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-SNAPSHOT
5.0.1-SNAPSHOT
4 changes: 2 additions & 2 deletions samples/server/petstore/java-vertx-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<exec-maven-plugin.version>1.5.0</exec-maven-plugin.version>

<vertx.version>4.0.0.Beta3</vertx.version>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
<vertx.version>4.0.0</vertx.version>
<junit-jupiter.version>5.7.0</junit-jupiter.version>
<slf4j.version>1.7.30</slf4j.version>
<jackson.version>2.11.2</jackson.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import io.vertx.core.http.HttpServerOptions;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.openapi.RouterFactory;
import io.vertx.ext.web.openapi.RouterFactoryOptions;
import io.vertx.ext.web.openapi.RouterBuilder;
import io.vertx.ext.web.openapi.RouterBuilderOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -26,18 +26,18 @@ public class HttpServerVerticle extends AbstractVerticle {

@Override
public void start(Promise<Void> startPromise) {
RouterFactory.create(vertx, specFile)
.map(factory -> {
factory.setOptions(new RouterFactoryOptions()
RouterBuilder.create(vertx, specFile)
.map(builder -> {
builder.setOptions(new RouterBuilderOptions()
// For production use case, you need to enable this flag and provide the proper security handler
.setRequireSecurityHandlers(false)
);

petHandler.mount(factory);
storeHandler.mount(factory);
userHandler.mount(factory);
petHandler.mount(builder);
storeHandler.mount(builder);
userHandler.mount(builder);

Router router = factory.createRouter();
Router router = builder.createRouter();
router.errorHandler(400, this::validationFailureHandler);

return router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import com.fasterxml.jackson.core.type.TypeReference;
import io.vertx.core.json.jackson.DatabindCodec;
import io.vertx.ext.web.openapi.RouterFactory;
import io.vertx.ext.web.openapi.RouterBuilder;
import io.vertx.ext.web.validation.RequestParameters;
import io.vertx.ext.web.validation.RequestParameter;
import io.vertx.ext.web.validation.ValidationHandler;
Expand All @@ -28,15 +28,15 @@ public PetApiHandler() {
this.apiImpl = new PetApiImpl();
}

public void mount(RouterFactory factory) {
factory.operation("addPet").handler(this::addPet);
factory.operation("deletePet").handler(this::deletePet);
factory.operation("findPetsByStatus").handler(this::findPetsByStatus);
factory.operation("findPetsByTags").handler(this::findPetsByTags);
factory.operation("getPetById").handler(this::getPetById);
factory.operation("updatePet").handler(this::updatePet);
factory.operation("updatePetWithForm").handler(this::updatePetWithForm);
factory.operation("uploadFile").handler(this::uploadFile);
public void mount(RouterBuilder builder) {
builder.operation("addPet").handler(this::addPet);
builder.operation("deletePet").handler(this::deletePet);
builder.operation("findPetsByStatus").handler(this::findPetsByStatus);
builder.operation("findPetsByTags").handler(this::findPetsByTags);
builder.operation("getPetById").handler(this::getPetById);
builder.operation("updatePet").handler(this::updatePet);
builder.operation("updatePetWithForm").handler(this::updatePetWithForm);
builder.operation("uploadFile").handler(this::uploadFile);
}

private void addPet(RoutingContext routingContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.fasterxml.jackson.core.type.TypeReference;
import io.vertx.core.json.jackson.DatabindCodec;
import io.vertx.ext.web.openapi.RouterFactory;
import io.vertx.ext.web.openapi.RouterBuilder;
import io.vertx.ext.web.validation.RequestParameters;
import io.vertx.ext.web.validation.RequestParameter;
import io.vertx.ext.web.validation.ValidationHandler;
Expand All @@ -26,11 +26,11 @@ public StoreApiHandler() {
this.apiImpl = new StoreApiImpl();
}

public void mount(RouterFactory factory) {
factory.operation("deleteOrder").handler(this::deleteOrder);
factory.operation("getInventory").handler(this::getInventory);
factory.operation("getOrderById").handler(this::getOrderById);
factory.operation("placeOrder").handler(this::placeOrder);
public void mount(RouterBuilder builder) {
builder.operation("deleteOrder").handler(this::deleteOrder);
builder.operation("getInventory").handler(this::getInventory);
builder.operation("getOrderById").handler(this::getOrderById);
builder.operation("placeOrder").handler(this::placeOrder);
}

private void deleteOrder(RoutingContext routingContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.fasterxml.jackson.core.type.TypeReference;
import io.vertx.core.json.jackson.DatabindCodec;
import io.vertx.ext.web.openapi.RouterFactory;
import io.vertx.ext.web.openapi.RouterBuilder;
import io.vertx.ext.web.validation.RequestParameters;
import io.vertx.ext.web.validation.RequestParameter;
import io.vertx.ext.web.validation.ValidationHandler;
Expand All @@ -26,15 +26,15 @@ public UserApiHandler() {
this.apiImpl = new UserApiImpl();
}

public void mount(RouterFactory factory) {
factory.operation("createUser").handler(this::createUser);
factory.operation("createUsersWithArrayInput").handler(this::createUsersWithArrayInput);
factory.operation("createUsersWithListInput").handler(this::createUsersWithListInput);
factory.operation("deleteUser").handler(this::deleteUser);
factory.operation("getUserByName").handler(this::getUserByName);
factory.operation("loginUser").handler(this::loginUser);
factory.operation("logoutUser").handler(this::logoutUser);
factory.operation("updateUser").handler(this::updateUser);
public void mount(RouterBuilder builder) {
builder.operation("createUser").handler(this::createUser);
builder.operation("createUsersWithArrayInput").handler(this::createUsersWithArrayInput);
builder.operation("createUsersWithListInput").handler(this::createUsersWithListInput);
builder.operation("deleteUser").handler(this::deleteUser);
builder.operation("getUserByName").handler(this::getUserByName);
builder.operation("loginUser").handler(this::loginUser);
builder.operation("logoutUser").handler(this::logoutUser);
builder.operation("updateUser").handler(this::updateUser);
}

private void createUser(RoutingContext routingContext) {
Expand Down

0 comments on commit 0b2aa21

Please sign in to comment.