From e6cee8eb7115d7fb8cc2a0fabe87bdcd1626c2cc Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 4 Feb 2021 16:36:55 +0800 Subject: [PATCH] Mark java-vertx as deprecated (#8609) * mark java-vert as deprecated * update, clean up samples * remove entrites related to java-vertx --- ...tx-web.yaml => java-vertx-web-server.yaml} | 0 docs/generators.md | 2 +- .../languages/JavaVertXServerCodegen.java | 12 + pom.xml | 4 +- .../async/.openapi-generator-ignore | 23 - .../java-vertx/async/.openapi-generator/FILES | 21 - .../async/.openapi-generator/VERSION | 1 - .../petstore/java-vertx/async/README.md | 0 .../server/petstore/java-vertx/async/pom.xml | 91 -- .../server/api/MainApiException.java | 22 - .../server/api/MainApiVerticle.java | 97 -- .../server/api/model/Category.java | 83 -- .../server/api/model/ModelApiResponse.java | 96 -- .../openapitools/server/api/model/Order.java | 157 --- .../openapitools/server/api/model/Pet.java | 160 --- .../openapitools/server/api/model/Tag.java | 83 -- .../openapitools/server/api/model/User.java | 161 --- .../server/api/verticle/PetApi.java | 39 - .../server/api/verticle/PetApiException.java | 29 - .../server/api/verticle/PetApiVerticle.java | 276 ----- .../server/api/verticle/StoreApi.java | 25 - .../api/verticle/StoreApiException.java | 21 - .../server/api/verticle/StoreApiVerticle.java | 152 --- .../server/api/verticle/UserApi.java | 37 - .../server/api/verticle/UserApiException.java | 22 - .../server/api/verticle/UserApiVerticle.java | 270 ---- .../async/src/main/resources/openapi.json | 1082 ----------------- .../vertx-default-jul-logging.properties | 30 - .../java-vertx/rx/.openapi-generator-ignore | 23 - .../java-vertx/rx/.openapi-generator/FILES | 21 - .../java-vertx/rx/.openapi-generator/VERSION | 1 - .../server/petstore/java-vertx/rx/README.md | 0 samples/server/petstore/java-vertx/rx/pom.xml | 91 -- .../server/api/MainApiException.java | 22 - .../server/api/MainApiVerticle.java | 97 -- .../server/api/model/Category.java | 83 -- .../server/api/model/ModelApiResponse.java | 96 -- .../openapitools/server/api/model/Order.java | 157 --- .../openapitools/server/api/model/Pet.java | 160 --- .../openapitools/server/api/model/Tag.java | 83 -- .../openapitools/server/api/model/User.java | 161 --- .../server/api/verticle/PetApi.java | 39 - .../server/api/verticle/PetApiException.java | 29 - .../server/api/verticle/PetApiVerticle.java | 268 ---- .../server/api/verticle/StoreApi.java | 25 - .../api/verticle/StoreApiException.java | 21 - .../server/api/verticle/StoreApiVerticle.java | 148 --- .../server/api/verticle/UserApi.java | 37 - .../server/api/verticle/UserApiException.java | 22 - .../server/api/verticle/UserApiVerticle.java | 262 ---- .../rx/src/main/resources/openapi.json | 1082 ----------------- .../vertx-default-jul-logging.properties | 30 - 52 files changed, 14 insertions(+), 5940 deletions(-) rename bin/configs/{other/java-vertx-web.yaml => java-vertx-web-server.yaml} (100%) delete mode 100644 samples/server/petstore/java-vertx/async/.openapi-generator-ignore delete mode 100644 samples/server/petstore/java-vertx/async/.openapi-generator/FILES delete mode 100644 samples/server/petstore/java-vertx/async/.openapi-generator/VERSION delete mode 100644 samples/server/petstore/java-vertx/async/README.md delete mode 100644 samples/server/petstore/java-vertx/async/pom.xml delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/async/src/main/resources/openapi.json delete mode 100644 samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties delete mode 100644 samples/server/petstore/java-vertx/rx/.openapi-generator-ignore delete mode 100644 samples/server/petstore/java-vertx/rx/.openapi-generator/FILES delete mode 100644 samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION delete mode 100644 samples/server/petstore/java-vertx/rx/README.md delete mode 100644 samples/server/petstore/java-vertx/rx/pom.xml delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json delete mode 100644 samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties diff --git a/bin/configs/other/java-vertx-web.yaml b/bin/configs/java-vertx-web-server.yaml similarity index 100% rename from bin/configs/other/java-vertx-web.yaml rename to bin/configs/java-vertx-web-server.yaml diff --git a/docs/generators.md b/docs/generators.md index 1b2aa656bfb..6b4406e43ac 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -94,7 +94,7 @@ The following generators are available: * [java-pkmst](generators/java-pkmst.md) * [java-play-framework](generators/java-play-framework.md) * [java-undertow-server](generators/java-undertow-server.md) -* [java-vertx](generators/java-vertx.md) +* [java-vertx (deprecated)](generators/java-vertx.md) * [java-vertx-web (beta)](generators/java-vertx-web.md) * [jaxrs-cxf](generators/jaxrs-cxf.md) * [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi.md) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java index fe44c4e9bab..d38f05ecfc6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java @@ -24,9 +24,14 @@ import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.servers.Server; import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.utils.URLPathUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.File; import java.net.URL; import java.util.List; @@ -37,6 +42,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class JavaVertXServerCodegen extends AbstractJavaCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(JavaVertXServerCodegen.class); protected String resourceFolder = "src/main/resources"; protected String rootPackage = "org.openapitools.server.api"; @@ -61,6 +67,10 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen { modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.DEPRECATED) + .build(); + // set the output folder here outputFolder = "generated-code" + File.separator + "javaVertXServer"; @@ -134,6 +144,8 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen { public void processOpts() { super.processOpts(); + LOGGER.warn("IMPORTANT: This generator has been deprecated. Please use `java-vertx-web` instead"); + apiTestTemplateFiles.clear(); importMapping.remove("JsonCreator"); diff --git a/pom.xml b/pom.xml index e7b5d046ec8..3276b5fd713 100644 --- a/pom.xml +++ b/pom.xml @@ -1260,8 +1260,7 @@ samples/server/petstore/jaxrs-spec samples/server/petstore/jaxrs-spec-interface samples/server/petstore/jaxrs-spec-interface-response - samples/server/petstore/java-vertx/rx - samples/server/petstore/java-vertx/async + samples/server/petstore/java-vertx-web samples/server/petstore/java-inflector samples/server/petstore/java-pkmst samples/server/petstore/java-play-framework @@ -1303,7 +1302,6 @@ samples/server/petstore/scala-play-server samples/server/petstore/scala-akka-http-server samples/server/petstore/scalatra - samples/server/petstore/java-vertx-web samples/server/petstore/scala-finch diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator-ignore b/samples/server/petstore/java-vertx/async/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a3..00000000000 --- a/samples/server/petstore/java-vertx/async/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator/FILES b/samples/server/petstore/java-vertx/async/.openapi-generator/FILES deleted file mode 100644 index d863c5cf45a..00000000000 --- a/samples/server/petstore/java-vertx/async/.openapi-generator/FILES +++ /dev/null @@ -1,21 +0,0 @@ -README.md -pom.xml -src/main/java/org/openapitools/server/api/MainApiException.java -src/main/java/org/openapitools/server/api/MainApiVerticle.java -src/main/java/org/openapitools/server/api/model/Category.java -src/main/java/org/openapitools/server/api/model/ModelApiResponse.java -src/main/java/org/openapitools/server/api/model/Order.java -src/main/java/org/openapitools/server/api/model/Pet.java -src/main/java/org/openapitools/server/api/model/Tag.java -src/main/java/org/openapitools/server/api/model/User.java -src/main/java/org/openapitools/server/api/verticle/PetApi.java -src/main/java/org/openapitools/server/api/verticle/PetApiException.java -src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/StoreApi.java -src/main/java/org/openapitools/server/api/verticle/StoreApiException.java -src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/UserApi.java -src/main/java/org/openapitools/server/api/verticle/UserApiException.java -src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java -src/main/resources/openapi.json -src/main/resources/vertx-default-jul-logging.properties diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION deleted file mode 100644 index 3fa3b389a57..00000000000 --- a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/README.md b/samples/server/petstore/java-vertx/async/README.md deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/samples/server/petstore/java-vertx/async/pom.xml b/samples/server/petstore/java-vertx/async/pom.xml deleted file mode 100644 index 217266e583e..00000000000 --- a/samples/server/petstore/java-vertx/async/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - 4.0.0 - - org.openapitools - openapi-java-vertx-server - 1.0.0-SNAPSHOT - jar - - OpenAPI Petstore - - - UTF-8 - 1.8 - 4.13.1 - 3.4.1 - 3.8.1 - 1.4.0 - 2.3 - 2.7.4 - - - - - junit - junit - ${junit.version} - test - - - - io.vertx - vertx-unit - ${vertx.version} - test - - - - com.github.phiz71 - vertx-swagger-router - ${vertx-swagger-router.version} - - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-datatype-jsr310.version} - - - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - - package - - shade - - - - - - io.vertx.core.Starter - org.openapitools.server.api.MainApiVerticle - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-fat.jar - - - - - - - diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java deleted file mode 100644 index 4aef710c011..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api; - -public class MainApiException extends Exception { - private int statusCode; - private String statusMessage; - - public MainApiException(int statusCode, String statusMessage) { - super(); - this.statusCode = statusCode; - this.statusMessage = statusMessage; - } - - public int getStatusCode() { - return statusCode; - } - - public String getStatusMessage() { - return statusMessage; - } - - public static final MainApiException INTERNAL_SERVER_ERROR = new MainApiException(500, "Internal Server Error"); -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java deleted file mode 100644 index 26381f058f1..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.openapitools.server.api; - -import java.nio.charset.Charset; - -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.github.phiz71.vertx.swagger.router.OperationIdServiceIdResolver; -import com.github.phiz71.vertx.swagger.router.SwaggerRouter; - -import io.swagger.models.Swagger; -import io.swagger.parser.SwaggerParser; -import io.vertx.core.AbstractVerticle; -import io.vertx.core.Context; -import io.vertx.core.Future; -import io.vertx.core.file.FileSystem; -import io.vertx.core.json.Json; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; -import io.vertx.core.Vertx; -import io.vertx.ext.web.Router; - -public class MainApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); - - private int serverPort = 8080; - protected Router router; - - public int getServerPort() { - return serverPort; - } - - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - @Override - public void init(Vertx vertx, Context context) { - super.init(vertx, context); - router = Router.router(vertx); - } - - @Override - public void start(Future startFuture) throws Exception { - Json.mapper.registerModule(new JavaTimeModule()); - FileSystem vertxFileSystem = vertx.fileSystem(); - vertxFileSystem.readFile("openapi.json", readFile -> { - if (readFile.succeeded()) { - Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8"))); - Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver()); - - deployVerticles(startFuture); - - vertx.createHttpServer() - .requestHandler(swaggerRouter::accept) - .listen(serverPort, h -> { - if (h.succeeded()) { - startFuture.complete(); - } else { - startFuture.fail(h.cause()); - } - }); - } else { - startFuture.fail(readFile.cause()); - } - }); - } - - public void deployVerticles(Future startFuture) { - - vertx.deployVerticle("org.openapitools.server.api.verticle.PetApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("PetApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("PetApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.StoreApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("StoreApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("StoreApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.UserApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("UserApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("UserApiVerticle : Deployment failed"); - } - }); - - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java deleted file mode 100644 index f05201c45ad..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A category for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Category { - - private Long id; - private String name; - - public Category () { - - } - - public Category (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return Objects.equals(id, category.id) && - Objects.equals(name, category.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java deleted file mode 100644 index 934a6efdf96..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Describes the result of uploading an image resource - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class ModelApiResponse { - - private Integer code; - private String type; - private String message; - - public ModelApiResponse () { - - } - - public ModelApiResponse (Integer code, String type, String message) { - this.code = code; - this.type = type; - this.message = message; - } - - - @JsonProperty("code") - public Integer getCode() { - return code; - } - public void setCode(Integer code) { - this.code = code; - } - - - @JsonProperty("type") - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(code, _apiResponse.code) && - Objects.equals(type, _apiResponse.type) && - Objects.equals(message, _apiResponse.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, type, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelApiResponse {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java deleted file mode 100644 index 0d8d6714212..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; - -/** - * An order for a pets from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Order { - - private Long id; - private Long petId; - private Integer quantity; - private OffsetDateTime shipDate; - - - public enum StatusEnum { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - private Boolean complete = false; - - public Order () { - - } - - public Order (Long id, Long petId, Integer quantity, OffsetDateTime shipDate, StatusEnum status, Boolean complete) { - this.id = id; - this.petId = petId; - this.quantity = quantity; - this.shipDate = shipDate; - this.status = status; - this.complete = complete; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("petId") - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - - @JsonProperty("quantity") - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - - @JsonProperty("shipDate") - public OffsetDateTime getShipDate() { - return shipDate; - } - public void setShipDate(OffsetDateTime shipDate) { - this.shipDate = shipDate; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @JsonProperty("complete") - public Boolean getComplete() { - return complete; - } - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Order order = (Order) o; - return Objects.equals(id, order.id) && - Objects.equals(petId, order.petId) && - Objects.equals(quantity, order.quantity) && - Objects.equals(shipDate, order.shipDate) && - Objects.equals(status, order.status) && - Objects.equals(complete, order.complete); - } - - @Override - public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); - sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); - sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java deleted file mode 100644 index cb9325acf5d..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.ArrayList; -import java.util.List; -import org.openapitools.server.api.model.Category; -import org.openapitools.server.api.model.Tag; - -/** - * A pet for sale in the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Pet { - - private Long id; - private Category category; - private String name; - private List photoUrls = new ArrayList<>(); - private List tags = new ArrayList<>(); - - - public enum StatusEnum { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - - public Pet () { - - } - - public Pet (Long id, Category category, String name, List photoUrls, List tags, StatusEnum status) { - this.id = id; - this.category = category; - this.name = name; - this.photoUrls = photoUrls; - this.tags = tags; - this.status = status; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(status, pet.status); - } - - @Override - public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java deleted file mode 100644 index 0389c2fbeea..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A tag for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Tag { - - private Long id; - private String name; - - public Tag () { - - } - - public Tag (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Tag tag = (Tag) o; - return Objects.equals(id, tag.id) && - Objects.equals(name, tag.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java deleted file mode 100644 index 0e1e8755555..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A User who is purchasing from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class User { - - private Long id; - private String username; - private String firstName; - private String lastName; - private String email; - private String password; - private String phone; - private Integer userStatus; - - public User () { - - } - - public User (Long id, String username, String firstName, String lastName, String email, String password, String phone, Integer userStatus) { - this.id = id; - this.username = username; - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - this.password = password; - this.phone = phone; - this.userStatus = userStatus; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("username") - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - - @JsonProperty("firstName") - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - - @JsonProperty("lastName") - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - - - @JsonProperty("email") - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - - @JsonProperty("password") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - @JsonProperty("phone") - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - - - @JsonProperty("userStatus") - public Integer getUserStatus() { - return userStatus; - } - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(id, user.id) && - Objects.equals(username, user.username) && - Objects.equals(firstName, user.firstName) && - Objects.equals(lastName, user.lastName) && - Objects.equals(email, user.email) && - Objects.equals(password, user.password) && - Objects.equals(phone, user.phone) && - Objects.equals(userStatus, user.userStatus); - } - - @Override - public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); - sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java deleted file mode 100644 index 7ec2b40b8ff..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; - -import java.util.List; -import java.util.Map; - -public interface PetApi { - //addPet - void addPet(Pet body, Handler> handler); - - //deletePet - void deletePet(Long petId, String apiKey, Handler> handler); - - //findPetsByStatus - void findPetsByStatus(List status, Handler>> handler); - - //findPetsByTags - void findPetsByTags(List tags, Handler>> handler); - - //getPetById - void getPetById(Long petId, Handler> handler); - - //updatePet - void updatePet(Pet body, Handler> handler); - - //updatePetWithForm - void updatePetWithForm(Long petId, String name, String status, Handler> handler); - - //uploadFile - void uploadFile(Long petId, String additionalMetadata, File file, Handler> handler); - -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java deleted file mode 100644 index d357d90ca1a..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -public final class PetApiException extends MainApiException { - public PetApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final PetApiException Pet_addPet_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_deletePet_400_Exception = new PetApiException(400, "Invalid pet value"); - public static final PetApiException Pet_findPetsByStatus_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByStatus_400_Exception = new PetApiException(400, "Invalid status value"); - public static final PetApiException Pet_findPetsByTags_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByTags_400_Exception = new PetApiException(400, "Invalid tag value"); - public static final PetApiException Pet_getPetById_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_getPetById_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_getPetById_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_updatePet_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_405_Exception = new PetApiException(405, "Validation exception"); - public static final PetApiException Pet_updatePetWithForm_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_uploadFile_200_Exception = new PetApiException(200, "successful operation"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java deleted file mode 100644 index d1849cb43f1..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java +++ /dev/null @@ -1,276 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import java.util.List; -import java.util.Map; - -public class PetApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); - - static final String ADDPET_SERVICE_ID = "addPet"; - static final String DELETEPET_SERVICE_ID = "deletePet"; - static final String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; - static final String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; - static final String GETPETBYID_SERVICE_ID = "getPetById"; - static final String UPDATEPET_SERVICE_ID = "updatePet"; - static final String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; - static final String UPLOADFILE_SERVICE_ID = "uploadFile"; - - final PetApi service; - - public PetApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.PetApiImpl"); - service = (PetApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("PetApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for addPet - vertx.eventBus(). consumer(ADDPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "addPet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.addPet(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "addPet"); - } - }); - } catch (Exception e) { - logUnexpectedError("addPet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deletePet - vertx.eventBus(). consumer(DELETEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deletePet"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String apiKeyParam = message.body().getString("api_key"); - String apiKey = (apiKeyParam == null) ? null : apiKeyParam; - service.deletePet(petId, apiKey, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "deletePet"); - } - }); - } catch (Exception e) { - logUnexpectedError("deletePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByStatus - vertx.eventBus(). consumer(FINDPETSBYSTATUS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByStatus"; - JsonArray statusParam = message.body().getJsonArray("status"); - if(statusParam == null) { - manageError(message, new MainApiException(400, "status is required"), serviceId); - return; - } - List status = Json.mapper.readValue(statusParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByStatus(status, result -> { - if (result.succeeded()) - message.reply(new JsonArray(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "findPetsByStatus"); - } - }); - } catch (Exception e) { - logUnexpectedError("findPetsByStatus", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByTags - vertx.eventBus(). consumer(FINDPETSBYTAGS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByTags"; - JsonArray tagsParam = message.body().getJsonArray("tags"); - if(tagsParam == null) { - manageError(message, new MainApiException(400, "tags is required"), serviceId); - return; - } - List tags = Json.mapper.readValue(tagsParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByTags(tags, result -> { - if (result.succeeded()) - message.reply(new JsonArray(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "findPetsByTags"); - } - }); - } catch (Exception e) { - logUnexpectedError("findPetsByTags", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getPetById - vertx.eventBus(). consumer(GETPETBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getPetById"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - service.getPetById(petId, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getPetById"); - } - }); - } catch (Exception e) { - logUnexpectedError("getPetById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePet - vertx.eventBus(). consumer(UPDATEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.updatePet(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "updatePet"); - } - }); - } catch (Exception e) { - logUnexpectedError("updatePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePetWithForm - vertx.eventBus(). consumer(UPDATEPETWITHFORM_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePetWithForm"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String nameParam = message.body().getString("name"); - String name = (nameParam == null) ? null : nameParam; - String statusParam = message.body().getString("status"); - String status = (statusParam == null) ? null : statusParam; - service.updatePetWithForm(petId, name, status, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "updatePetWithForm"); - } - }); - } catch (Exception e) { - logUnexpectedError("updatePetWithForm", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for uploadFile - vertx.eventBus(). consumer(UPLOADFILE_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "uploadFile"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String additionalMetadataParam = message.body().getString("additionalMetadata"); - String additionalMetadata = (additionalMetadataParam == null) ? null : additionalMetadataParam; - String fileParam = message.body().getString("file"); - File file = (fileParam == null) ? null : Json.mapper.readValue(fileParam, File.class); - service.uploadFile(petId, additionalMetadata, file, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "uploadFile"); - } - }); - } catch (Exception e) { - logUnexpectedError("uploadFile", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java deleted file mode 100644 index 656978f999b..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; - -import java.util.List; -import java.util.Map; - -public interface StoreApi { - //deleteOrder - void deleteOrder(String orderId, Handler> handler); - - //getInventory - void getInventory(Handler>> handler); - - //getOrderById - void getOrderById(Long orderId, Handler> handler); - - //placeOrder - void placeOrder(Order body, Handler> handler); - -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java deleted file mode 100644 index 7a7a7ea59fb..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -public final class StoreApiException extends MainApiException { - public StoreApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final StoreApiException Store_deleteOrder_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_deleteOrder_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_getInventory_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_getOrderById_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_placeOrder_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_placeOrder_400_Exception = new StoreApiException(400, "Invalid Order"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java deleted file mode 100644 index b8cb7b01f36..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import java.util.List; -import java.util.Map; - -public class StoreApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); - - static final String DELETEORDER_SERVICE_ID = "deleteOrder"; - static final String GETINVENTORY_SERVICE_ID = "getInventory"; - static final String GETORDERBYID_SERVICE_ID = "getOrderById"; - static final String PLACEORDER_SERVICE_ID = "placeOrder"; - - final StoreApi service; - - public StoreApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.StoreApiImpl"); - service = (StoreApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("StoreApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for deleteOrder - vertx.eventBus(). consumer(DELETEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteOrder"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - String orderId = orderIdParam; - service.deleteOrder(orderId, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "deleteOrder"); - } - }); - } catch (Exception e) { - logUnexpectedError("deleteOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getInventory - vertx.eventBus(). consumer(GETINVENTORY_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getInventory"; - service.getInventory(result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getInventory"); - } - }); - } catch (Exception e) { - logUnexpectedError("getInventory", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getOrderById - vertx.eventBus(). consumer(GETORDERBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getOrderById"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - Long orderId = Json.mapper.readValue(orderIdParam, Long.class); - service.getOrderById(orderId, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getOrderById"); - } - }); - } catch (Exception e) { - logUnexpectedError("getOrderById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for placeOrder - vertx.eventBus(). consumer(PLACEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "placeOrder"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Order body = Json.mapper.readValue(bodyParam.encode(), Order.class); - service.placeOrder(body, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "placeOrder"); - } - }); - } catch (Exception e) { - logUnexpectedError("placeOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java deleted file mode 100644 index 28f23b1501b..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; - -import java.util.List; -import java.util.Map; - -public interface UserApi { - //createUser - void createUser(User body, Handler> handler); - - //createUsersWithArrayInput - void createUsersWithArrayInput(List body, Handler> handler); - - //createUsersWithListInput - void createUsersWithListInput(List body, Handler> handler); - - //deleteUser - void deleteUser(String username, Handler> handler); - - //getUserByName - void getUserByName(String username, Handler> handler); - - //loginUser - void loginUser(String username, String password, Handler> handler); - - //logoutUser - void logoutUser(Handler> handler); - - //updateUser - void updateUser(String username, User body, Handler> handler); - -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java deleted file mode 100644 index 3fdf14a842e..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -public final class UserApiException extends MainApiException { - public UserApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final UserApiException User_deleteUser_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_deleteUser_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_getUserByName_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_getUserByName_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_getUserByName_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_loginUser_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_loginUser_400_Exception = new UserApiException(400, "Invalid username/password supplied"); - public static final UserApiException User_updateUser_400_Exception = new UserApiException(400, "Invalid user supplied"); - public static final UserApiException User_updateUser_404_Exception = new UserApiException(404, "User not found"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java deleted file mode 100644 index 61ac44f5584..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import java.util.List; -import java.util.Map; - -public class UserApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); - - static final String CREATEUSER_SERVICE_ID = "createUser"; - static final String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; - static final String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; - static final String DELETEUSER_SERVICE_ID = "deleteUser"; - static final String GETUSERBYNAME_SERVICE_ID = "getUserByName"; - static final String LOGINUSER_SERVICE_ID = "loginUser"; - static final String LOGOUTUSER_SERVICE_ID = "logoutUser"; - static final String UPDATEUSER_SERVICE_ID = "updateUser"; - - final UserApi service; - - public UserApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.UserApiImpl"); - service = (UserApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("UserApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for createUser - vertx.eventBus(). consumer(CREATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUser"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.createUser(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "createUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("createUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithArrayInput - vertx.eventBus(). consumer(CREATEUSERSWITHARRAYINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithArrayInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithArrayInput(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "createUsersWithArrayInput"); - } - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithArrayInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithListInput - vertx.eventBus(). consumer(CREATEUSERSWITHLISTINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithListInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithListInput(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "createUsersWithListInput"); - } - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithListInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deleteUser - vertx.eventBus(). consumer(DELETEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.deleteUser(username, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "deleteUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("deleteUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getUserByName - vertx.eventBus(). consumer(GETUSERBYNAME_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getUserByName"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.getUserByName(username, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getUserByName"); - } - }); - } catch (Exception e) { - logUnexpectedError("getUserByName", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for loginUser - vertx.eventBus(). consumer(LOGINUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "loginUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - String passwordParam = message.body().getString("password"); - if(passwordParam == null) { - manageError(message, new MainApiException(400, "password is required"), serviceId); - return; - } - String password = passwordParam; - service.loginUser(username, password, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "loginUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("loginUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for logoutUser - vertx.eventBus(). consumer(LOGOUTUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "logoutUser"; - service.logoutUser(result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "logoutUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("logoutUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updateUser - vertx.eventBus(). consumer(UPDATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updateUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.updateUser(username, body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "updateUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("updateUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json deleted file mode 100644 index c292bb5e95a..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json +++ /dev/null @@ -1,1082 +0,0 @@ -{ - "openapi" : "3.0.1", - "info" : { - "description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.", - "license" : { - "name" : "Apache-2.0", - "url" : "https://www.apache.org/licenses/LICENSE-2.0.html" - }, - "title" : "OpenAPI Petstore", - "version" : "1.0.0" - }, - "servers" : [ { - "url" : "http://petstore.swagger.io/v2" - } ], - "tags" : [ { - "description" : "Everything about your Pets", - "name" : "pet" - }, { - "description" : "Access to Petstore orders", - "name" : "store" - }, { - "description" : "Operations about user", - "name" : "user" - } ], - "paths" : { - "/pet" : { - "post" : { - "operationId" : "addPet", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - }, - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - } - }, - "description" : "Pet object that needs to be added to the store", - "required" : true - }, - "responses" : { - "405" : { - "content" : { }, - "description" : "Invalid input" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Add a new pet to the store", - "tags" : [ "pet" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "addPet", - "x-serviceid-varname" : "ADDPET_SERVICE_ID" - }, - "put" : { - "operationId" : "updatePet", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - }, - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - } - }, - "description" : "Pet object that needs to be added to the store", - "required" : true - }, - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Pet not found" - }, - "405" : { - "content" : { }, - "description" : "Validation exception" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Update an existing pet", - "tags" : [ "pet" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "updatePet", - "x-serviceid-varname" : "UPDATEPET_SERVICE_ID" - } - }, - "/pet/findByStatus" : { - "get" : { - "description" : "Multiple status values can be provided with comma separated strings", - "operationId" : "findPetsByStatus", - "parameters" : [ { - "description" : "Status values that need to be considered for filter", - "explode" : false, - "in" : "query", - "name" : "status", - "required" : true, - "schema" : { - "items" : { - "default" : "available", - "enum" : [ "available", "pending", "sold" ], - "type" : "string" - }, - "type" : "array" - }, - "style" : "form" - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - }, - "application/json" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid status value" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Finds Pets by status", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "findPetsByStatus", - "x-serviceid-varname" : "FINDPETSBYSTATUS_SERVICE_ID" - } - }, - "/pet/findByTags" : { - "get" : { - "deprecated" : true, - "description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - "operationId" : "findPetsByTags", - "parameters" : [ { - "description" : "Tags to filter by", - "explode" : false, - "in" : "query", - "name" : "tags", - "required" : true, - "schema" : { - "items" : { - "type" : "string" - }, - "type" : "array" - }, - "style" : "form" - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - }, - "application/json" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid tag value" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Finds Pets by tags", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "findPetsByTags", - "x-serviceid-varname" : "FINDPETSBYTAGS_SERVICE_ID" - } - }, - "/pet/{petId}" : { - "delete" : { - "operationId" : "deletePet", - "parameters" : [ { - "in" : "header", - "name" : "api_key", - "schema" : { - "type" : "string" - } - }, { - "description" : "Pet id to delete", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid pet value" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Deletes a pet", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "deletePet", - "x-serviceid-varname" : "DELETEPET_SERVICE_ID" - }, - "get" : { - "description" : "Returns a single pet", - "operationId" : "getPetById", - "parameters" : [ { - "description" : "ID of pet to return", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Pet not found" - } - }, - "security" : [ { - "api_key" : [ ] - } ], - "summary" : "Find pet by ID", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "getPetById", - "x-serviceid-varname" : "GETPETBYID_SERVICE_ID" - }, - "post" : { - "operationId" : "updatePetWithForm", - "parameters" : [ { - "description" : "ID of pet that needs to be updated", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "requestBody" : { - "content" : { - "application/x-www-form-urlencoded" : { - "schema" : { - "properties" : { - "name" : { - "description" : "Updated name of the pet", - "type" : "string" - }, - "status" : { - "description" : "Updated status of the pet", - "type" : "string" - } - } - } - } - } - }, - "responses" : { - "405" : { - "content" : { }, - "description" : "Invalid input" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Updates a pet in the store with form data", - "tags" : [ "pet" ], - "x-contentType" : "application/x-www-form-urlencoded", - "x-accepts" : "application/json", - "x-serviceid" : "updatePetWithForm", - "x-serviceid-varname" : "UPDATEPETWITHFORM_SERVICE_ID" - } - }, - "/pet/{petId}/uploadImage" : { - "post" : { - "operationId" : "uploadFile", - "parameters" : [ { - "description" : "ID of pet to update", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "requestBody" : { - "content" : { - "multipart/form-data" : { - "schema" : { - "properties" : { - "additionalMetadata" : { - "description" : "Additional data to pass to server", - "type" : "string" - }, - "file" : { - "description" : "file to upload", - "format" : "binary", - "type" : "string" - } - } - } - } - } - }, - "responses" : { - "200" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ApiResponse" - } - } - }, - "description" : "successful operation" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "uploads an image", - "tags" : [ "pet" ], - "x-contentType" : "multipart/form-data", - "x-accepts" : "application/json", - "x-serviceid" : "uploadFile", - "x-serviceid-varname" : "UPLOADFILE_SERVICE_ID" - } - }, - "/store/inventory" : { - "get" : { - "description" : "Returns a map of status codes to quantities", - "operationId" : "getInventory", - "responses" : { - "200" : { - "content" : { - "application/json" : { - "schema" : { - "additionalProperties" : { - "format" : "int32", - "type" : "integer" - }, - "type" : "object" - } - } - }, - "description" : "successful operation" - } - }, - "security" : [ { - "api_key" : [ ] - } ], - "summary" : "Returns pet inventories by status", - "tags" : [ "store" ], - "x-accepts" : "application/json", - "x-serviceid" : "getInventory", - "x-serviceid-varname" : "GETINVENTORY_SERVICE_ID" - } - }, - "/store/order" : { - "post" : { - "operationId" : "placeOrder", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - } - }, - "description" : "order placed for purchasing the pet", - "required" : true - }, - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid Order" - } - }, - "summary" : "Place an order for a pet", - "tags" : [ "store" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "placeOrder", - "x-serviceid-varname" : "PLACEORDER_SERVICE_ID" - } - }, - "/store/order/{orderId}" : { - "delete" : { - "description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId" : "deleteOrder", - "parameters" : [ { - "description" : "ID of the order that needs to be deleted", - "in" : "path", - "name" : "orderId", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Order not found" - } - }, - "summary" : "Delete purchase order by ID", - "tags" : [ "store" ], - "x-accepts" : "application/json", - "x-serviceid" : "deleteOrder", - "x-serviceid-varname" : "DELETEORDER_SERVICE_ID" - }, - "get" : { - "description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId" : "getOrderById", - "parameters" : [ { - "description" : "ID of pet that needs to be fetched", - "in" : "path", - "name" : "orderId", - "required" : true, - "schema" : { - "format" : "int64", - "maximum" : 5, - "minimum" : 1, - "type" : "integer" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Order not found" - } - }, - "summary" : "Find purchase order by ID", - "tags" : [ "store" ], - "x-accepts" : "application/json", - "x-serviceid" : "getOrderById", - "x-serviceid-varname" : "GETORDERBYID_SERVICE_ID" - } - }, - "/user" : { - "post" : { - "description" : "This can only be done by the logged in user.", - "operationId" : "createUser", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - } - }, - "description" : "Created user object", - "required" : true - }, - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Create user", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "createUser", - "x-serviceid-varname" : "CREATEUSER_SERVICE_ID" - } - }, - "/user/createWithArray" : { - "post" : { - "operationId" : "createUsersWithArrayInput", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/User" - }, - "type" : "array" - } - } - }, - "description" : "List of user object", - "required" : true - }, - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Creates list of users with given input array", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "createUsersWithArrayInput", - "x-serviceid-varname" : "CREATEUSERSWITHARRAYINPUT_SERVICE_ID" - } - }, - "/user/createWithList" : { - "post" : { - "operationId" : "createUsersWithListInput", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/User" - }, - "type" : "array" - } - } - }, - "description" : "List of user object", - "required" : true - }, - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Creates list of users with given input array", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "createUsersWithListInput", - "x-serviceid-varname" : "CREATEUSERSWITHLISTINPUT_SERVICE_ID" - } - }, - "/user/login" : { - "get" : { - "operationId" : "loginUser", - "parameters" : [ { - "description" : "The user name for login", - "in" : "query", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "description" : "The password for login in clear text", - "in" : "query", - "name" : "password", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "type" : "string" - } - }, - "application/json" : { - "schema" : { - "type" : "string" - } - } - }, - "description" : "successful operation", - "headers" : { - "X-Rate-Limit" : { - "description" : "calls per hour allowed by the user", - "schema" : { - "format" : "int32", - "type" : "integer" - } - }, - "X-Expires-After" : { - "description" : "date in UTC when toekn expires", - "schema" : { - "format" : "date-time", - "type" : "string" - } - } - } - }, - "400" : { - "content" : { }, - "description" : "Invalid username/password supplied" - } - }, - "summary" : "Logs user into the system", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "loginUser", - "x-serviceid-varname" : "LOGINUSER_SERVICE_ID" - } - }, - "/user/logout" : { - "get" : { - "operationId" : "logoutUser", - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Logs out current logged in user session", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "logoutUser", - "x-serviceid-varname" : "LOGOUTUSER_SERVICE_ID" - } - }, - "/user/{username}" : { - "delete" : { - "description" : "This can only be done by the logged in user.", - "operationId" : "deleteUser", - "parameters" : [ { - "description" : "The name that needs to be deleted", - "in" : "path", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid username supplied" - }, - "404" : { - "content" : { }, - "description" : "User not found" - } - }, - "summary" : "Delete user", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "deleteUser", - "x-serviceid-varname" : "DELETEUSER_SERVICE_ID" - }, - "get" : { - "operationId" : "getUserByName", - "parameters" : [ { - "description" : "The name that needs to be fetched. Use user1 for testing.", - "in" : "path", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid username supplied" - }, - "404" : { - "content" : { }, - "description" : "User not found" - } - }, - "summary" : "Get user by user name", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "getUserByName", - "x-serviceid-varname" : "GETUSERBYNAME_SERVICE_ID" - }, - "put" : { - "description" : "This can only be done by the logged in user.", - "operationId" : "updateUser", - "parameters" : [ { - "description" : "name that need to be deleted", - "in" : "path", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - } - }, - "description" : "Updated user object", - "required" : true - }, - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid user supplied" - }, - "404" : { - "content" : { }, - "description" : "User not found" - } - }, - "summary" : "Updated user", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "updateUser", - "x-serviceid-varname" : "UPDATEUSER_SERVICE_ID" - } - } - }, - "components" : { - "schemas" : { - "Order" : { - "description" : "An order for a pets from the pet store", - "example" : { - "petId" : 6, - "quantity" : 1, - "id" : 0, - "shipDate" : "2000-01-23T04:56:07.000+00:00", - "complete" : false, - "status" : "placed" - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "petId" : { - "format" : "int64", - "type" : "integer" - }, - "quantity" : { - "format" : "int32", - "type" : "integer" - }, - "shipDate" : { - "format" : "date-time", - "type" : "string" - }, - "status" : { - "description" : "Order Status", - "enum" : [ "placed", "approved", "delivered" ], - "type" : "string" - }, - "complete" : { - "default" : false, - "type" : "boolean" - } - }, - "title" : "Pet Order", - "type" : "object", - "xml" : { - "name" : "Order" - } - }, - "Category" : { - "description" : "A category for a pet", - "example" : { - "name" : "name", - "id" : 6 - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "name" : { - "type" : "string" - } - }, - "title" : "Pet category", - "type" : "object", - "xml" : { - "name" : "Category" - } - }, - "User" : { - "description" : "A User who is purchasing from the pet store", - "example" : { - "firstName" : "firstName", - "lastName" : "lastName", - "password" : "password", - "userStatus" : 6, - "phone" : "phone", - "id" : 0, - "email" : "email", - "username" : "username" - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "username" : { - "type" : "string" - }, - "firstName" : { - "type" : "string" - }, - "lastName" : { - "type" : "string" - }, - "email" : { - "type" : "string" - }, - "password" : { - "type" : "string" - }, - "phone" : { - "type" : "string" - }, - "userStatus" : { - "description" : "User Status", - "format" : "int32", - "type" : "integer" - } - }, - "title" : "a User", - "type" : "object", - "xml" : { - "name" : "User" - } - }, - "Tag" : { - "description" : "A tag for a pet", - "example" : { - "name" : "name", - "id" : 1 - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "name" : { - "type" : "string" - } - }, - "title" : "Pet Tag", - "type" : "object", - "xml" : { - "name" : "Tag" - } - }, - "Pet" : { - "description" : "A pet for sale in the pet store", - "example" : { - "photoUrls" : [ "photoUrls", "photoUrls" ], - "name" : "doggie", - "id" : 0, - "category" : { - "name" : "name", - "id" : 6 - }, - "tags" : [ { - "name" : "name", - "id" : 1 - }, { - "name" : "name", - "id" : 1 - } ], - "status" : "available" - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "category" : { - "$ref" : "#/components/schemas/Category" - }, - "name" : { - "example" : "doggie", - "type" : "string" - }, - "photoUrls" : { - "items" : { - "type" : "string" - }, - "type" : "array", - "xml" : { - "name" : "photoUrl", - "wrapped" : true - } - }, - "tags" : { - "items" : { - "$ref" : "#/components/schemas/Tag" - }, - "type" : "array", - "xml" : { - "name" : "tag", - "wrapped" : true - } - }, - "status" : { - "description" : "pet status in the store", - "enum" : [ "available", "pending", "sold" ], - "type" : "string" - } - }, - "required" : [ "name", "photoUrls" ], - "title" : "a Pet", - "type" : "object", - "xml" : { - "name" : "Pet" - } - }, - "ApiResponse" : { - "description" : "Describes the result of uploading an image resource", - "example" : { - "code" : 0, - "type" : "type", - "message" : "message" - }, - "properties" : { - "code" : { - "format" : "int32", - "type" : "integer" - }, - "type" : { - "type" : "string" - }, - "message" : { - "type" : "string" - } - }, - "title" : "An uploaded response", - "type" : "object" - } - }, - "securitySchemes" : { - "petstore_auth" : { - "flows" : { - "implicit" : { - "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", - "scopes" : { - "write:pets" : "modify pets in your account", - "read:pets" : "read your pets" - } - } - }, - "type" : "oauth2" - }, - "api_key" : { - "in" : "header", - "name" : "api_key", - "type" : "apiKey" - } - } - }, - "x-original-swagger-version" : "2.0" -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties b/samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties deleted file mode 100644 index 706d6d9b2f4..00000000000 --- a/samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2014 Red Hat, Inc. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# and Apache License v2.0 which accompanies this distribution. -# -# The Eclipse Public License is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# The Apache License v2.0 is available at -# http://www.opensource.org/licenses/apache2.0.php -# -# You may elect to redistribute this code under either of these licenses. -# -handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler -java.util.logging.SimpleFormatter.format=%5$s %6$s\n -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.FileHandler.level=INFO -java.util.logging.FileHandler.formatter=io.vertx.core.logging.VertxLoggerFormatter - -# Put the log in the system temporary directory -java.util.logging.FileHandler.pattern=vertx.log - -.level=INFO -io.vertx.ext.web.level=FINEST -io.vertx.level=INFO -com.hazelcast.level=INFO -io.netty.util.internal.PlatformDependent.level=SEVERE \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator-ignore b/samples/server/petstore/java-vertx/rx/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a3..00000000000 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator/FILES b/samples/server/petstore/java-vertx/rx/.openapi-generator/FILES deleted file mode 100644 index d863c5cf45a..00000000000 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator/FILES +++ /dev/null @@ -1,21 +0,0 @@ -README.md -pom.xml -src/main/java/org/openapitools/server/api/MainApiException.java -src/main/java/org/openapitools/server/api/MainApiVerticle.java -src/main/java/org/openapitools/server/api/model/Category.java -src/main/java/org/openapitools/server/api/model/ModelApiResponse.java -src/main/java/org/openapitools/server/api/model/Order.java -src/main/java/org/openapitools/server/api/model/Pet.java -src/main/java/org/openapitools/server/api/model/Tag.java -src/main/java/org/openapitools/server/api/model/User.java -src/main/java/org/openapitools/server/api/verticle/PetApi.java -src/main/java/org/openapitools/server/api/verticle/PetApiException.java -src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/StoreApi.java -src/main/java/org/openapitools/server/api/verticle/StoreApiException.java -src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/UserApi.java -src/main/java/org/openapitools/server/api/verticle/UserApiException.java -src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java -src/main/resources/openapi.json -src/main/resources/vertx-default-jul-logging.properties diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION deleted file mode 100644 index 3fa3b389a57..00000000000 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/README.md b/samples/server/petstore/java-vertx/rx/README.md deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/samples/server/petstore/java-vertx/rx/pom.xml b/samples/server/petstore/java-vertx/rx/pom.xml deleted file mode 100644 index 2b575c68e75..00000000000 --- a/samples/server/petstore/java-vertx/rx/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - 4.0.0 - - org.openapitools - java-vertx-rx-server - 1.0.0-SNAPSHOT - jar - - OpenAPI Petstore - - - UTF-8 - 1.8 - 4.13.1 - 3.4.1 - 3.8.1 - 1.4.0 - 2.3 - 2.7.4 - - - - - junit - junit - ${junit.version} - test - - - - io.vertx - vertx-unit - ${vertx.version} - test - - - - com.github.phiz71 - vertx-swagger-router - ${vertx-swagger-router.version} - - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-datatype-jsr310.version} - - - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - - package - - shade - - - - - - io.vertx.core.Starter - org.openapitools.server.api.MainApiVerticle - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-fat.jar - - - - - - - diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java deleted file mode 100644 index 4aef710c011..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api; - -public class MainApiException extends Exception { - private int statusCode; - private String statusMessage; - - public MainApiException(int statusCode, String statusMessage) { - super(); - this.statusCode = statusCode; - this.statusMessage = statusMessage; - } - - public int getStatusCode() { - return statusCode; - } - - public String getStatusMessage() { - return statusMessage; - } - - public static final MainApiException INTERNAL_SERVER_ERROR = new MainApiException(500, "Internal Server Error"); -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java deleted file mode 100644 index 26381f058f1..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.openapitools.server.api; - -import java.nio.charset.Charset; - -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.github.phiz71.vertx.swagger.router.OperationIdServiceIdResolver; -import com.github.phiz71.vertx.swagger.router.SwaggerRouter; - -import io.swagger.models.Swagger; -import io.swagger.parser.SwaggerParser; -import io.vertx.core.AbstractVerticle; -import io.vertx.core.Context; -import io.vertx.core.Future; -import io.vertx.core.file.FileSystem; -import io.vertx.core.json.Json; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; -import io.vertx.core.Vertx; -import io.vertx.ext.web.Router; - -public class MainApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); - - private int serverPort = 8080; - protected Router router; - - public int getServerPort() { - return serverPort; - } - - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - @Override - public void init(Vertx vertx, Context context) { - super.init(vertx, context); - router = Router.router(vertx); - } - - @Override - public void start(Future startFuture) throws Exception { - Json.mapper.registerModule(new JavaTimeModule()); - FileSystem vertxFileSystem = vertx.fileSystem(); - vertxFileSystem.readFile("openapi.json", readFile -> { - if (readFile.succeeded()) { - Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8"))); - Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver()); - - deployVerticles(startFuture); - - vertx.createHttpServer() - .requestHandler(swaggerRouter::accept) - .listen(serverPort, h -> { - if (h.succeeded()) { - startFuture.complete(); - } else { - startFuture.fail(h.cause()); - } - }); - } else { - startFuture.fail(readFile.cause()); - } - }); - } - - public void deployVerticles(Future startFuture) { - - vertx.deployVerticle("org.openapitools.server.api.verticle.PetApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("PetApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("PetApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.StoreApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("StoreApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("StoreApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.UserApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("UserApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("UserApiVerticle : Deployment failed"); - } - }); - - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java deleted file mode 100644 index f05201c45ad..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A category for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Category { - - private Long id; - private String name; - - public Category () { - - } - - public Category (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return Objects.equals(id, category.id) && - Objects.equals(name, category.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java deleted file mode 100644 index 934a6efdf96..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Describes the result of uploading an image resource - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class ModelApiResponse { - - private Integer code; - private String type; - private String message; - - public ModelApiResponse () { - - } - - public ModelApiResponse (Integer code, String type, String message) { - this.code = code; - this.type = type; - this.message = message; - } - - - @JsonProperty("code") - public Integer getCode() { - return code; - } - public void setCode(Integer code) { - this.code = code; - } - - - @JsonProperty("type") - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(code, _apiResponse.code) && - Objects.equals(type, _apiResponse.type) && - Objects.equals(message, _apiResponse.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, type, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelApiResponse {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java deleted file mode 100644 index 0d8d6714212..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; - -/** - * An order for a pets from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Order { - - private Long id; - private Long petId; - private Integer quantity; - private OffsetDateTime shipDate; - - - public enum StatusEnum { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - private Boolean complete = false; - - public Order () { - - } - - public Order (Long id, Long petId, Integer quantity, OffsetDateTime shipDate, StatusEnum status, Boolean complete) { - this.id = id; - this.petId = petId; - this.quantity = quantity; - this.shipDate = shipDate; - this.status = status; - this.complete = complete; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("petId") - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - - @JsonProperty("quantity") - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - - @JsonProperty("shipDate") - public OffsetDateTime getShipDate() { - return shipDate; - } - public void setShipDate(OffsetDateTime shipDate) { - this.shipDate = shipDate; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @JsonProperty("complete") - public Boolean getComplete() { - return complete; - } - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Order order = (Order) o; - return Objects.equals(id, order.id) && - Objects.equals(petId, order.petId) && - Objects.equals(quantity, order.quantity) && - Objects.equals(shipDate, order.shipDate) && - Objects.equals(status, order.status) && - Objects.equals(complete, order.complete); - } - - @Override - public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); - sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); - sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java deleted file mode 100644 index cb9325acf5d..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.ArrayList; -import java.util.List; -import org.openapitools.server.api.model.Category; -import org.openapitools.server.api.model.Tag; - -/** - * A pet for sale in the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Pet { - - private Long id; - private Category category; - private String name; - private List photoUrls = new ArrayList<>(); - private List tags = new ArrayList<>(); - - - public enum StatusEnum { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - - public Pet () { - - } - - public Pet (Long id, Category category, String name, List photoUrls, List tags, StatusEnum status) { - this.id = id; - this.category = category; - this.name = name; - this.photoUrls = photoUrls; - this.tags = tags; - this.status = status; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(status, pet.status); - } - - @Override - public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java deleted file mode 100644 index 0389c2fbeea..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A tag for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Tag { - - private Long id; - private String name; - - public Tag () { - - } - - public Tag (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Tag tag = (Tag) o; - return Objects.equals(id, tag.id) && - Objects.equals(name, tag.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java deleted file mode 100644 index 0e1e8755555..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A User who is purchasing from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class User { - - private Long id; - private String username; - private String firstName; - private String lastName; - private String email; - private String password; - private String phone; - private Integer userStatus; - - public User () { - - } - - public User (Long id, String username, String firstName, String lastName, String email, String password, String phone, Integer userStatus) { - this.id = id; - this.username = username; - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - this.password = password; - this.phone = phone; - this.userStatus = userStatus; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("username") - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - - @JsonProperty("firstName") - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - - @JsonProperty("lastName") - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - - - @JsonProperty("email") - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - - @JsonProperty("password") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - @JsonProperty("phone") - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - - - @JsonProperty("userStatus") - public Integer getUserStatus() { - return userStatus; - } - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(id, user.id) && - Objects.equals(username, user.username) && - Objects.equals(firstName, user.firstName) && - Objects.equals(lastName, user.lastName) && - Objects.equals(email, user.email) && - Objects.equals(password, user.password) && - Objects.equals(phone, user.phone) && - Objects.equals(userStatus, user.userStatus); - } - - @Override - public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); - sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java deleted file mode 100644 index ae86f9bee70..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import rx.Completable; -import rx.Single; - -import java.util.List; -import java.util.Map; - -public interface PetApi { - //addPet - public Completable addPet(Pet body); - - //deletePet - public Completable deletePet(Long petId,String apiKey); - - //findPetsByStatus - public Single> findPetsByStatus(List status); - - //findPetsByTags - public Single> findPetsByTags(List tags); - - //getPetById - public Single getPetById(Long petId); - - //updatePet - public Completable updatePet(Pet body); - - //updatePetWithForm - public Completable updatePetWithForm(Long petId,String name,String status); - - //uploadFile - public Single uploadFile(Long petId,String additionalMetadata,File file); - -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java deleted file mode 100644 index d357d90ca1a..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -public final class PetApiException extends MainApiException { - public PetApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final PetApiException Pet_addPet_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_deletePet_400_Exception = new PetApiException(400, "Invalid pet value"); - public static final PetApiException Pet_findPetsByStatus_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByStatus_400_Exception = new PetApiException(400, "Invalid status value"); - public static final PetApiException Pet_findPetsByTags_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByTags_400_Exception = new PetApiException(400, "Invalid tag value"); - public static final PetApiException Pet_getPetById_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_getPetById_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_getPetById_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_updatePet_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_405_Exception = new PetApiException(405, "Validation exception"); - public static final PetApiException Pet_updatePetWithForm_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_uploadFile_200_Exception = new PetApiException(200, "successful operation"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java deleted file mode 100644 index 2d5cfdb068b..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import java.util.List; -import java.util.Map; - -public class PetApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); - - static final String ADDPET_SERVICE_ID = "addPet"; - static final String DELETEPET_SERVICE_ID = "deletePet"; - static final String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; - static final String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; - static final String GETPETBYID_SERVICE_ID = "getPetById"; - static final String UPDATEPET_SERVICE_ID = "updatePet"; - static final String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; - static final String UPLOADFILE_SERVICE_ID = "uploadFile"; - - final PetApi service; - - public PetApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.PetApiImpl"); - service = (PetApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("PetApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for addPet - vertx.eventBus(). consumer(ADDPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "addPet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.addPet(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "addPet"); - }); - } catch (Exception e) { - logUnexpectedError("addPet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deletePet - vertx.eventBus(). consumer(DELETEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deletePet"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String apiKeyParam = message.body().getString("api_key"); - String apiKey = (apiKeyParam == null) ? null : apiKeyParam; - service.deletePet(petId, apiKey).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "deletePet"); - }); - } catch (Exception e) { - logUnexpectedError("deletePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByStatus - vertx.eventBus(). consumer(FINDPETSBYSTATUS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByStatus"; - JsonArray statusParam = message.body().getJsonArray("status"); - if(statusParam == null) { - manageError(message, new MainApiException(400, "status is required"), serviceId); - return; - } - List status = Json.mapper.readValue(statusParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByStatus(status).subscribe( - result -> { - message.reply(new JsonArray(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "findPetsByStatus"); - }); - } catch (Exception e) { - logUnexpectedError("findPetsByStatus", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByTags - vertx.eventBus(). consumer(FINDPETSBYTAGS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByTags"; - JsonArray tagsParam = message.body().getJsonArray("tags"); - if(tagsParam == null) { - manageError(message, new MainApiException(400, "tags is required"), serviceId); - return; - } - List tags = Json.mapper.readValue(tagsParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByTags(tags).subscribe( - result -> { - message.reply(new JsonArray(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "findPetsByTags"); - }); - } catch (Exception e) { - logUnexpectedError("findPetsByTags", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getPetById - vertx.eventBus(). consumer(GETPETBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getPetById"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - service.getPetById(petId).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getPetById"); - }); - } catch (Exception e) { - logUnexpectedError("getPetById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePet - vertx.eventBus(). consumer(UPDATEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.updatePet(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "updatePet"); - }); - } catch (Exception e) { - logUnexpectedError("updatePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePetWithForm - vertx.eventBus(). consumer(UPDATEPETWITHFORM_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePetWithForm"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String nameParam = message.body().getString("name"); - String name = (nameParam == null) ? null : nameParam; - String statusParam = message.body().getString("status"); - String status = (statusParam == null) ? null : statusParam; - service.updatePetWithForm(petId, name, status).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "updatePetWithForm"); - }); - } catch (Exception e) { - logUnexpectedError("updatePetWithForm", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for uploadFile - vertx.eventBus(). consumer(UPLOADFILE_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "uploadFile"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String additionalMetadataParam = message.body().getString("additionalMetadata"); - String additionalMetadata = (additionalMetadataParam == null) ? null : additionalMetadataParam; - String fileParam = message.body().getString("file"); - File file = (fileParam == null) ? null : Json.mapper.readValue(fileParam, File.class); - service.uploadFile(petId, additionalMetadata, file).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "uploadFile"); - }); - } catch (Exception e) { - logUnexpectedError("uploadFile", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java deleted file mode 100644 index 8f9c735708b..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import rx.Completable; -import rx.Single; - -import java.util.List; -import java.util.Map; - -public interface StoreApi { - //deleteOrder - public Completable deleteOrder(String orderId); - - //getInventory - public Single> getInventory(); - - //getOrderById - public Single getOrderById(Long orderId); - - //placeOrder - public Single placeOrder(Order body); - -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java deleted file mode 100644 index 7a7a7ea59fb..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -public final class StoreApiException extends MainApiException { - public StoreApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final StoreApiException Store_deleteOrder_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_deleteOrder_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_getInventory_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_getOrderById_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_placeOrder_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_placeOrder_400_Exception = new StoreApiException(400, "Invalid Order"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java deleted file mode 100644 index f8b2d9ce0aa..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import java.util.List; -import java.util.Map; - -public class StoreApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); - - static final String DELETEORDER_SERVICE_ID = "deleteOrder"; - static final String GETINVENTORY_SERVICE_ID = "getInventory"; - static final String GETORDERBYID_SERVICE_ID = "getOrderById"; - static final String PLACEORDER_SERVICE_ID = "placeOrder"; - - final StoreApi service; - - public StoreApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.StoreApiImpl"); - service = (StoreApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("StoreApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for deleteOrder - vertx.eventBus(). consumer(DELETEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteOrder"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - String orderId = orderIdParam; - service.deleteOrder(orderId).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "deleteOrder"); - }); - } catch (Exception e) { - logUnexpectedError("deleteOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getInventory - vertx.eventBus(). consumer(GETINVENTORY_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getInventory"; - service.getInventory().subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getInventory"); - }); - } catch (Exception e) { - logUnexpectedError("getInventory", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getOrderById - vertx.eventBus(). consumer(GETORDERBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getOrderById"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - Long orderId = Json.mapper.readValue(orderIdParam, Long.class); - service.getOrderById(orderId).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getOrderById"); - }); - } catch (Exception e) { - logUnexpectedError("getOrderById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for placeOrder - vertx.eventBus(). consumer(PLACEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "placeOrder"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Order body = Json.mapper.readValue(bodyParam.encode(), Order.class); - service.placeOrder(body).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "placeOrder"); - }); - } catch (Exception e) { - logUnexpectedError("placeOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java deleted file mode 100644 index cc6be61055c..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import rx.Completable; -import rx.Single; - -import java.util.List; -import java.util.Map; - -public interface UserApi { - //createUser - public Completable createUser(User body); - - //createUsersWithArrayInput - public Completable createUsersWithArrayInput(List body); - - //createUsersWithListInput - public Completable createUsersWithListInput(List body); - - //deleteUser - public Completable deleteUser(String username); - - //getUserByName - public Single getUserByName(String username); - - //loginUser - public Single loginUser(String username,String password); - - //logoutUser - public Completable logoutUser(); - - //updateUser - public Completable updateUser(String username,User body); - -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java deleted file mode 100644 index 3fdf14a842e..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -public final class UserApiException extends MainApiException { - public UserApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final UserApiException User_deleteUser_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_deleteUser_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_getUserByName_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_getUserByName_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_getUserByName_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_loginUser_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_loginUser_400_Exception = new UserApiException(400, "Invalid username/password supplied"); - public static final UserApiException User_updateUser_400_Exception = new UserApiException(400, "Invalid user supplied"); - public static final UserApiException User_updateUser_404_Exception = new UserApiException(404, "User not found"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java deleted file mode 100644 index 756b31863fa..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java +++ /dev/null @@ -1,262 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import java.util.List; -import java.util.Map; - -public class UserApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); - - static final String CREATEUSER_SERVICE_ID = "createUser"; - static final String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; - static final String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; - static final String DELETEUSER_SERVICE_ID = "deleteUser"; - static final String GETUSERBYNAME_SERVICE_ID = "getUserByName"; - static final String LOGINUSER_SERVICE_ID = "loginUser"; - static final String LOGOUTUSER_SERVICE_ID = "logoutUser"; - static final String UPDATEUSER_SERVICE_ID = "updateUser"; - - final UserApi service; - - public UserApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.UserApiImpl"); - service = (UserApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("UserApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for createUser - vertx.eventBus(). consumer(CREATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUser"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.createUser(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "createUser"); - }); - } catch (Exception e) { - logUnexpectedError("createUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithArrayInput - vertx.eventBus(). consumer(CREATEUSERSWITHARRAYINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithArrayInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithArrayInput(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "createUsersWithArrayInput"); - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithArrayInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithListInput - vertx.eventBus(). consumer(CREATEUSERSWITHLISTINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithListInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithListInput(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "createUsersWithListInput"); - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithListInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deleteUser - vertx.eventBus(). consumer(DELETEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.deleteUser(username).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "deleteUser"); - }); - } catch (Exception e) { - logUnexpectedError("deleteUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getUserByName - vertx.eventBus(). consumer(GETUSERBYNAME_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getUserByName"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.getUserByName(username).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getUserByName"); - }); - } catch (Exception e) { - logUnexpectedError("getUserByName", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for loginUser - vertx.eventBus(). consumer(LOGINUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "loginUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - String passwordParam = message.body().getString("password"); - if(passwordParam == null) { - manageError(message, new MainApiException(400, "password is required"), serviceId); - return; - } - String password = passwordParam; - service.loginUser(username, password).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "loginUser"); - }); - } catch (Exception e) { - logUnexpectedError("loginUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for logoutUser - vertx.eventBus(). consumer(LOGOUTUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "logoutUser"; - service.logoutUser().subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "logoutUser"); - }); - } catch (Exception e) { - logUnexpectedError("logoutUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updateUser - vertx.eventBus(). consumer(UPDATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updateUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.updateUser(username, body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "updateUser"); - }); - } catch (Exception e) { - logUnexpectedError("updateUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json deleted file mode 100644 index c292bb5e95a..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json +++ /dev/null @@ -1,1082 +0,0 @@ -{ - "openapi" : "3.0.1", - "info" : { - "description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.", - "license" : { - "name" : "Apache-2.0", - "url" : "https://www.apache.org/licenses/LICENSE-2.0.html" - }, - "title" : "OpenAPI Petstore", - "version" : "1.0.0" - }, - "servers" : [ { - "url" : "http://petstore.swagger.io/v2" - } ], - "tags" : [ { - "description" : "Everything about your Pets", - "name" : "pet" - }, { - "description" : "Access to Petstore orders", - "name" : "store" - }, { - "description" : "Operations about user", - "name" : "user" - } ], - "paths" : { - "/pet" : { - "post" : { - "operationId" : "addPet", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - }, - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - } - }, - "description" : "Pet object that needs to be added to the store", - "required" : true - }, - "responses" : { - "405" : { - "content" : { }, - "description" : "Invalid input" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Add a new pet to the store", - "tags" : [ "pet" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "addPet", - "x-serviceid-varname" : "ADDPET_SERVICE_ID" - }, - "put" : { - "operationId" : "updatePet", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - }, - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - } - }, - "description" : "Pet object that needs to be added to the store", - "required" : true - }, - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Pet not found" - }, - "405" : { - "content" : { }, - "description" : "Validation exception" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Update an existing pet", - "tags" : [ "pet" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "updatePet", - "x-serviceid-varname" : "UPDATEPET_SERVICE_ID" - } - }, - "/pet/findByStatus" : { - "get" : { - "description" : "Multiple status values can be provided with comma separated strings", - "operationId" : "findPetsByStatus", - "parameters" : [ { - "description" : "Status values that need to be considered for filter", - "explode" : false, - "in" : "query", - "name" : "status", - "required" : true, - "schema" : { - "items" : { - "default" : "available", - "enum" : [ "available", "pending", "sold" ], - "type" : "string" - }, - "type" : "array" - }, - "style" : "form" - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - }, - "application/json" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid status value" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Finds Pets by status", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "findPetsByStatus", - "x-serviceid-varname" : "FINDPETSBYSTATUS_SERVICE_ID" - } - }, - "/pet/findByTags" : { - "get" : { - "deprecated" : true, - "description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - "operationId" : "findPetsByTags", - "parameters" : [ { - "description" : "Tags to filter by", - "explode" : false, - "in" : "query", - "name" : "tags", - "required" : true, - "schema" : { - "items" : { - "type" : "string" - }, - "type" : "array" - }, - "style" : "form" - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - }, - "application/json" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/Pet" - }, - "type" : "array" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid tag value" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Finds Pets by tags", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "findPetsByTags", - "x-serviceid-varname" : "FINDPETSBYTAGS_SERVICE_ID" - } - }, - "/pet/{petId}" : { - "delete" : { - "operationId" : "deletePet", - "parameters" : [ { - "in" : "header", - "name" : "api_key", - "schema" : { - "type" : "string" - } - }, { - "description" : "Pet id to delete", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid pet value" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Deletes a pet", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "deletePet", - "x-serviceid-varname" : "DELETEPET_SERVICE_ID" - }, - "get" : { - "description" : "Returns a single pet", - "operationId" : "getPetById", - "parameters" : [ { - "description" : "ID of pet to return", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Pet" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Pet not found" - } - }, - "security" : [ { - "api_key" : [ ] - } ], - "summary" : "Find pet by ID", - "tags" : [ "pet" ], - "x-accepts" : "application/json", - "x-serviceid" : "getPetById", - "x-serviceid-varname" : "GETPETBYID_SERVICE_ID" - }, - "post" : { - "operationId" : "updatePetWithForm", - "parameters" : [ { - "description" : "ID of pet that needs to be updated", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "requestBody" : { - "content" : { - "application/x-www-form-urlencoded" : { - "schema" : { - "properties" : { - "name" : { - "description" : "Updated name of the pet", - "type" : "string" - }, - "status" : { - "description" : "Updated status of the pet", - "type" : "string" - } - } - } - } - } - }, - "responses" : { - "405" : { - "content" : { }, - "description" : "Invalid input" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "Updates a pet in the store with form data", - "tags" : [ "pet" ], - "x-contentType" : "application/x-www-form-urlencoded", - "x-accepts" : "application/json", - "x-serviceid" : "updatePetWithForm", - "x-serviceid-varname" : "UPDATEPETWITHFORM_SERVICE_ID" - } - }, - "/pet/{petId}/uploadImage" : { - "post" : { - "operationId" : "uploadFile", - "parameters" : [ { - "description" : "ID of pet to update", - "in" : "path", - "name" : "petId", - "required" : true, - "schema" : { - "format" : "int64", - "type" : "integer" - } - } ], - "requestBody" : { - "content" : { - "multipart/form-data" : { - "schema" : { - "properties" : { - "additionalMetadata" : { - "description" : "Additional data to pass to server", - "type" : "string" - }, - "file" : { - "description" : "file to upload", - "format" : "binary", - "type" : "string" - } - } - } - } - } - }, - "responses" : { - "200" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ApiResponse" - } - } - }, - "description" : "successful operation" - } - }, - "security" : [ { - "petstore_auth" : [ "write:pets", "read:pets" ] - } ], - "summary" : "uploads an image", - "tags" : [ "pet" ], - "x-contentType" : "multipart/form-data", - "x-accepts" : "application/json", - "x-serviceid" : "uploadFile", - "x-serviceid-varname" : "UPLOADFILE_SERVICE_ID" - } - }, - "/store/inventory" : { - "get" : { - "description" : "Returns a map of status codes to quantities", - "operationId" : "getInventory", - "responses" : { - "200" : { - "content" : { - "application/json" : { - "schema" : { - "additionalProperties" : { - "format" : "int32", - "type" : "integer" - }, - "type" : "object" - } - } - }, - "description" : "successful operation" - } - }, - "security" : [ { - "api_key" : [ ] - } ], - "summary" : "Returns pet inventories by status", - "tags" : [ "store" ], - "x-accepts" : "application/json", - "x-serviceid" : "getInventory", - "x-serviceid-varname" : "GETINVENTORY_SERVICE_ID" - } - }, - "/store/order" : { - "post" : { - "operationId" : "placeOrder", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - } - }, - "description" : "order placed for purchasing the pet", - "required" : true - }, - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid Order" - } - }, - "summary" : "Place an order for a pet", - "tags" : [ "store" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "placeOrder", - "x-serviceid-varname" : "PLACEORDER_SERVICE_ID" - } - }, - "/store/order/{orderId}" : { - "delete" : { - "description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId" : "deleteOrder", - "parameters" : [ { - "description" : "ID of the order that needs to be deleted", - "in" : "path", - "name" : "orderId", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Order not found" - } - }, - "summary" : "Delete purchase order by ID", - "tags" : [ "store" ], - "x-accepts" : "application/json", - "x-serviceid" : "deleteOrder", - "x-serviceid-varname" : "DELETEORDER_SERVICE_ID" - }, - "get" : { - "description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId" : "getOrderById", - "parameters" : [ { - "description" : "ID of pet that needs to be fetched", - "in" : "path", - "name" : "orderId", - "required" : true, - "schema" : { - "format" : "int64", - "maximum" : 5, - "minimum" : 1, - "type" : "integer" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Order" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid ID supplied" - }, - "404" : { - "content" : { }, - "description" : "Order not found" - } - }, - "summary" : "Find purchase order by ID", - "tags" : [ "store" ], - "x-accepts" : "application/json", - "x-serviceid" : "getOrderById", - "x-serviceid-varname" : "GETORDERBYID_SERVICE_ID" - } - }, - "/user" : { - "post" : { - "description" : "This can only be done by the logged in user.", - "operationId" : "createUser", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - } - }, - "description" : "Created user object", - "required" : true - }, - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Create user", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "createUser", - "x-serviceid-varname" : "CREATEUSER_SERVICE_ID" - } - }, - "/user/createWithArray" : { - "post" : { - "operationId" : "createUsersWithArrayInput", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/User" - }, - "type" : "array" - } - } - }, - "description" : "List of user object", - "required" : true - }, - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Creates list of users with given input array", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "createUsersWithArrayInput", - "x-serviceid-varname" : "CREATEUSERSWITHARRAYINPUT_SERVICE_ID" - } - }, - "/user/createWithList" : { - "post" : { - "operationId" : "createUsersWithListInput", - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "items" : { - "$ref" : "#/components/schemas/User" - }, - "type" : "array" - } - } - }, - "description" : "List of user object", - "required" : true - }, - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Creates list of users with given input array", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "createUsersWithListInput", - "x-serviceid-varname" : "CREATEUSERSWITHLISTINPUT_SERVICE_ID" - } - }, - "/user/login" : { - "get" : { - "operationId" : "loginUser", - "parameters" : [ { - "description" : "The user name for login", - "in" : "query", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "description" : "The password for login in clear text", - "in" : "query", - "name" : "password", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "type" : "string" - } - }, - "application/json" : { - "schema" : { - "type" : "string" - } - } - }, - "description" : "successful operation", - "headers" : { - "X-Rate-Limit" : { - "description" : "calls per hour allowed by the user", - "schema" : { - "format" : "int32", - "type" : "integer" - } - }, - "X-Expires-After" : { - "description" : "date in UTC when toekn expires", - "schema" : { - "format" : "date-time", - "type" : "string" - } - } - } - }, - "400" : { - "content" : { }, - "description" : "Invalid username/password supplied" - } - }, - "summary" : "Logs user into the system", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "loginUser", - "x-serviceid-varname" : "LOGINUSER_SERVICE_ID" - } - }, - "/user/logout" : { - "get" : { - "operationId" : "logoutUser", - "responses" : { - "default" : { - "content" : { }, - "description" : "successful operation" - } - }, - "summary" : "Logs out current logged in user session", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "logoutUser", - "x-serviceid-varname" : "LOGOUTUSER_SERVICE_ID" - } - }, - "/user/{username}" : { - "delete" : { - "description" : "This can only be done by the logged in user.", - "operationId" : "deleteUser", - "parameters" : [ { - "description" : "The name that needs to be deleted", - "in" : "path", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid username supplied" - }, - "404" : { - "content" : { }, - "description" : "User not found" - } - }, - "summary" : "Delete user", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "deleteUser", - "x-serviceid-varname" : "DELETEUSER_SERVICE_ID" - }, - "get" : { - "operationId" : "getUserByName", - "parameters" : [ { - "description" : "The name that needs to be fetched. Use user1 for testing.", - "in" : "path", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "content" : { - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - }, - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - } - }, - "description" : "successful operation" - }, - "400" : { - "content" : { }, - "description" : "Invalid username supplied" - }, - "404" : { - "content" : { }, - "description" : "User not found" - } - }, - "summary" : "Get user by user name", - "tags" : [ "user" ], - "x-accepts" : "application/json", - "x-serviceid" : "getUserByName", - "x-serviceid-varname" : "GETUSERBYNAME_SERVICE_ID" - }, - "put" : { - "description" : "This can only be done by the logged in user.", - "operationId" : "updateUser", - "parameters" : [ { - "description" : "name that need to be deleted", - "in" : "path", - "name" : "username", - "required" : true, - "schema" : { - "type" : "string" - } - } ], - "requestBody" : { - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/User" - } - } - }, - "description" : "Updated user object", - "required" : true - }, - "responses" : { - "400" : { - "content" : { }, - "description" : "Invalid user supplied" - }, - "404" : { - "content" : { }, - "description" : "User not found" - } - }, - "summary" : "Updated user", - "tags" : [ "user" ], - "x-codegen-request-body-name" : "body", - "x-contentType" : "*/*", - "x-accepts" : "application/json", - "x-serviceid" : "updateUser", - "x-serviceid-varname" : "UPDATEUSER_SERVICE_ID" - } - } - }, - "components" : { - "schemas" : { - "Order" : { - "description" : "An order for a pets from the pet store", - "example" : { - "petId" : 6, - "quantity" : 1, - "id" : 0, - "shipDate" : "2000-01-23T04:56:07.000+00:00", - "complete" : false, - "status" : "placed" - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "petId" : { - "format" : "int64", - "type" : "integer" - }, - "quantity" : { - "format" : "int32", - "type" : "integer" - }, - "shipDate" : { - "format" : "date-time", - "type" : "string" - }, - "status" : { - "description" : "Order Status", - "enum" : [ "placed", "approved", "delivered" ], - "type" : "string" - }, - "complete" : { - "default" : false, - "type" : "boolean" - } - }, - "title" : "Pet Order", - "type" : "object", - "xml" : { - "name" : "Order" - } - }, - "Category" : { - "description" : "A category for a pet", - "example" : { - "name" : "name", - "id" : 6 - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "name" : { - "type" : "string" - } - }, - "title" : "Pet category", - "type" : "object", - "xml" : { - "name" : "Category" - } - }, - "User" : { - "description" : "A User who is purchasing from the pet store", - "example" : { - "firstName" : "firstName", - "lastName" : "lastName", - "password" : "password", - "userStatus" : 6, - "phone" : "phone", - "id" : 0, - "email" : "email", - "username" : "username" - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "username" : { - "type" : "string" - }, - "firstName" : { - "type" : "string" - }, - "lastName" : { - "type" : "string" - }, - "email" : { - "type" : "string" - }, - "password" : { - "type" : "string" - }, - "phone" : { - "type" : "string" - }, - "userStatus" : { - "description" : "User Status", - "format" : "int32", - "type" : "integer" - } - }, - "title" : "a User", - "type" : "object", - "xml" : { - "name" : "User" - } - }, - "Tag" : { - "description" : "A tag for a pet", - "example" : { - "name" : "name", - "id" : 1 - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "name" : { - "type" : "string" - } - }, - "title" : "Pet Tag", - "type" : "object", - "xml" : { - "name" : "Tag" - } - }, - "Pet" : { - "description" : "A pet for sale in the pet store", - "example" : { - "photoUrls" : [ "photoUrls", "photoUrls" ], - "name" : "doggie", - "id" : 0, - "category" : { - "name" : "name", - "id" : 6 - }, - "tags" : [ { - "name" : "name", - "id" : 1 - }, { - "name" : "name", - "id" : 1 - } ], - "status" : "available" - }, - "properties" : { - "id" : { - "format" : "int64", - "type" : "integer" - }, - "category" : { - "$ref" : "#/components/schemas/Category" - }, - "name" : { - "example" : "doggie", - "type" : "string" - }, - "photoUrls" : { - "items" : { - "type" : "string" - }, - "type" : "array", - "xml" : { - "name" : "photoUrl", - "wrapped" : true - } - }, - "tags" : { - "items" : { - "$ref" : "#/components/schemas/Tag" - }, - "type" : "array", - "xml" : { - "name" : "tag", - "wrapped" : true - } - }, - "status" : { - "description" : "pet status in the store", - "enum" : [ "available", "pending", "sold" ], - "type" : "string" - } - }, - "required" : [ "name", "photoUrls" ], - "title" : "a Pet", - "type" : "object", - "xml" : { - "name" : "Pet" - } - }, - "ApiResponse" : { - "description" : "Describes the result of uploading an image resource", - "example" : { - "code" : 0, - "type" : "type", - "message" : "message" - }, - "properties" : { - "code" : { - "format" : "int32", - "type" : "integer" - }, - "type" : { - "type" : "string" - }, - "message" : { - "type" : "string" - } - }, - "title" : "An uploaded response", - "type" : "object" - } - }, - "securitySchemes" : { - "petstore_auth" : { - "flows" : { - "implicit" : { - "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", - "scopes" : { - "write:pets" : "modify pets in your account", - "read:pets" : "read your pets" - } - } - }, - "type" : "oauth2" - }, - "api_key" : { - "in" : "header", - "name" : "api_key", - "type" : "apiKey" - } - } - }, - "x-original-swagger-version" : "2.0" -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties b/samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties deleted file mode 100644 index 706d6d9b2f4..00000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2014 Red Hat, Inc. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# and Apache License v2.0 which accompanies this distribution. -# -# The Eclipse Public License is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# The Apache License v2.0 is available at -# http://www.opensource.org/licenses/apache2.0.php -# -# You may elect to redistribute this code under either of these licenses. -# -handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler -java.util.logging.SimpleFormatter.format=%5$s %6$s\n -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.FileHandler.level=INFO -java.util.logging.FileHandler.formatter=io.vertx.core.logging.VertxLoggerFormatter - -# Put the log in the system temporary directory -java.util.logging.FileHandler.pattern=vertx.log - -.level=INFO -io.vertx.ext.web.level=FINEST -io.vertx.level=INFO -com.hazelcast.level=INFO -io.netty.util.internal.PlatformDependent.level=SEVERE \ No newline at end of file