forked from loafle/openapi-generator-original
Bumped Vert.x template to Vert.x 4 GA (#8528)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b203539869
commit
0b2aa21f5d
@@ -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;
|
||||
@@ -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}}
|
||||
}
|
||||
|
||||
@@ -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}}
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.0.0-SNAPSHOT
|
||||
5.0.1-SNAPSHOT
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.openapitools.vertxweb.server.model.Pet;
|
||||
|
||||
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;
|
||||
@@ -28,15 +28,15 @@ public class 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) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.openapitools.vertxweb.server.model.Order;
|
||||
|
||||
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;
|
||||
@@ -26,11 +26,11 @@ public class 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) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.openapitools.vertxweb.server.model.User;
|
||||
|
||||
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;
|
||||
@@ -26,15 +26,15 @@ public class 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) {
|
||||
|
||||
Reference in New Issue
Block a user