From 5ac14b851ec8efa2dac776f731352c7f39e5e13c Mon Sep 17 00:00:00 2001 From: Chuckledog Date: Tue, 4 Feb 2020 15:07:16 +0100 Subject: [PATCH 01/14] Added library and edited generator to support server stub generation with Kumuluzee framework. --- .../languages/JavaJAXRSSpecServerCodegen.java | 15 +++- .../spec/libraries/kumuluzee/README.mustache | 36 ++++++++ .../libraries/kumuluzee/beans.xml.mustache | 5 ++ .../libraries/kumuluzee/config.yaml.mustache | 5 ++ .../microprofile-config.properties.mustache | 1 + .../spec/libraries/kumuluzee/pom.mustache | 84 +++++++++++++++++++ 6 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index f47edb272eb8..6a38f2e81ccb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -43,6 +43,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String THORNTAIL_LIBRARY = "thorntail"; public static final String OPEN_LIBERTY_LIBRARY = "openliberty"; public static final String HELIDON_LIBRARY = "helidon"; + public static final String KUMULUZEE_LIBRARY = "kumuluzee"; private boolean interfaceOnly = false; private boolean returnResponse = false; @@ -99,6 +100,7 @@ public JavaJAXRSSpecServerCodegen() { supportedLibraries.put(THORNTAIL_LIBRARY, "Server using Thorntail"); supportedLibraries.put(OPEN_LIBERTY_LIBRARY, "Server using Open Liberty"); supportedLibraries.put(HELIDON_LIBRARY, "Server using Helidon"); + supportedLibraries.put(KUMULUZEE_LIBRARY, "Server using Kumuluzee"); library.setEnum(supportedLibraries); cliOptions.add(library); @@ -126,17 +128,20 @@ public void processOpts() { additionalProperties.remove(RETURN_RESPONSE); } } - if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library)) { + if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) { useSwaggerAnnotations = false; } else { if (additionalProperties.containsKey(USE_SWAGGER_ANNOTATIONS)) { useSwaggerAnnotations = Boolean.valueOf(additionalProperties.get(USE_SWAGGER_ANNOTATIONS).toString()); } } + if (KUMULUZEE_LIBRARY.equals(library)){ + super.setSourceFolder("src/main/java"); + } writePropertyBack(USE_SWAGGER_ANNOTATIONS, useSwaggerAnnotations); if (additionalProperties.containsKey(OPEN_API_SPEC_FILE_LOCATION)) { openApiSpecFileLocation = additionalProperties.get(OPEN_API_SPEC_FILE_LOCATION).toString(); - } else if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library)) { + } else if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) { openApiSpecFileLocation = "src/main/resources/META-INF/openapi.yaml"; } else if(OPEN_LIBERTY_LIBRARY.equals(library)) { openApiSpecFileLocation = "src/main/webapp/META-INF/openapi.yaml"; @@ -194,7 +199,11 @@ public void processOpts() { writeOptional(outputFolder, new SupportingFile("logging.properties.mustache", "src/main/resources", "logging.properties")); writeOptional(outputFolder, new SupportingFile("microprofile-config.properties.mustache", "src/main/resources/META-INF", "microprofile-config.properties")); writeOptional(outputFolder, new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml")); - } + } else if(KUMULUZEE_LIBRARY.equals(library)) { + writeOptional(outputFolder, new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); + writeOptional(outputFolder, new SupportingFile("beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); + writeOptional(outputFolder, new SupportingFile("microprofile-config.properties.mustache", "src/main/resources/META-INF", "microprofile-config.properties")); + } } @Override diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache new file mode 100644 index 000000000000..f6ae20f3fc68 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache @@ -0,0 +1,36 @@ +# JAX-RS server with OpenAPI using Kumuluzee + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework and +the [Eclipse-MicroProfile-OpenAPI](https://github.com/eclipse/microprofile-open-api) addition. + +The pom file is configured to use [Kumuluzee](https://ee.kumuluz.com/) as application server. + +{{#interfaceOnly}} + This project produces a jar that defines some interfaces. + The jar can be used in combination with an other project providing the implementation. +{{/interfaceOnly}} + +{{^interfaceOnly}} + To build the server, run this maven command: + + ```bash + mvn clean package + ``` + + To run the server, run this maven command: + + ```bash + java -jar target/${project.build.finalName}.jar + ``` + + You can then call your server endpoints under: + + ``` + http://localhost:8080/ + ``` +{{/interfaceOnly}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache new file mode 100644 index 000000000000..17d17df35c24 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache new file mode 100644 index 000000000000..89d106104bcc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache @@ -0,0 +1,5 @@ +kumuluzee: + name: {{artifactId}} + version: 1.0.0 + env: + name: dev \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache new file mode 100644 index 000000000000..c3fe390239c8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache @@ -0,0 +1 @@ +mp.openapi.scan.disable=true \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache new file mode 100644 index 000000000000..728b32b2ec35 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache @@ -0,0 +1,84 @@ + + + 4.0.0 + + {{groupId}} + {{artifactId}} + {{artifactId}} + {{artifactVersion}} + + jar + + + 1.8 + 1.8 + UTF-8 + + 3.5.0 + + + + + + com.kumuluz.ee + kumuluzee-bom + ${kumuluzee.version} + pom + import + + + + + + + com.kumuluz.ee + kumuluzee-core + + + com.kumuluz.ee + kumuluzee-servlet-jetty + + + com.kumuluz.ee + kumuluzee-cdi-weld + + + com.kumuluz.ee + kumuluzee-jax-rs-jersey + + + com.kumuluz.ee + kumuluzee-el-uel + + + com.kumuluz.ee + kumuluzee-bean-validation-hibernate-validator + + + jakarta.xml.bind + jakarta.xml.bind-api + 2.3.2 + + + + + + + com.kumuluz.ee + kumuluzee-maven-plugin + ${kumuluzee.version} + + + package + + repackage + + + + + + + + \ No newline at end of file From 6dd9802d315ded3fbddd881dc763993d02025aef Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Wed, 5 Feb 2020 14:14:34 +0100 Subject: [PATCH 02/14] Trimmed and tweaked pom.xml template and removed unnecessary template files from generator and library. --- .../languages/JavaJAXRSSpecServerCodegen.java | 2 -- .../spec/libraries/kumuluzee/README.mustache | 8 +++++- .../libraries/kumuluzee/beans.xml.mustache | 5 ---- .../libraries/kumuluzee/config.yaml.mustache | 2 +- .../microprofile-config.properties.mustache | 1 - .../spec/libraries/kumuluzee/pom.mustache | 25 +++---------------- 6 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache delete mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 6a38f2e81ccb..2cd5d0b8531a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -201,8 +201,6 @@ public void processOpts() { writeOptional(outputFolder, new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml")); } else if(KUMULUZEE_LIBRARY.equals(library)) { writeOptional(outputFolder, new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); - writeOptional(outputFolder, new SupportingFile("beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); - writeOptional(outputFolder, new SupportingFile("microprofile-config.properties.mustache", "src/main/resources/META-INF", "microprofile-config.properties")); } } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache index f6ae20f3fc68..b6b483f4e14f 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache @@ -31,6 +31,12 @@ The pom file is configured to use [Kumuluzee](https://ee.kumuluz.com/) as applic You can then call your server endpoints under: ``` - http://localhost:8080/ + http://localhost:8080 + ``` + + Example endpoint: + + ``` + http://localhost:8080/v2/user/example ``` {{/interfaceOnly}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache deleted file mode 100644 index 17d17df35c24..000000000000 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/beans.xml.mustache +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache index 89d106104bcc..e6a77b619a79 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache @@ -1,5 +1,5 @@ kumuluzee: - name: {{artifactId}} + name: openapi-jaxrs-kumuluzee-server version: 1.0.0 env: name: dev \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache deleted file mode 100644 index c3fe390239c8..000000000000 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/microprofile-config.properties.mustache +++ /dev/null @@ -1 +0,0 @@ -mp.openapi.scan.disable=true \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache index 728b32b2ec35..1e59ff4eb285 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache @@ -5,9 +5,9 @@ 4.0.0 {{groupId}} - {{artifactId}} - {{artifactId}} - {{artifactVersion}} + openapi-jaxrs-kumuluzee-server + openapi-jaxrs-kumuluzee-server + 1.0.0-SNAPSHOT jar @@ -16,7 +16,7 @@ 1.8 UTF-8 - 3.5.0 + 3.7.0 @@ -40,27 +40,10 @@ com.kumuluz.ee kumuluzee-servlet-jetty - - com.kumuluz.ee - kumuluzee-cdi-weld - com.kumuluz.ee kumuluzee-jax-rs-jersey - - com.kumuluz.ee - kumuluzee-el-uel - - - com.kumuluz.ee - kumuluzee-bean-validation-hibernate-validator - - - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.2 - From 49e8a0a92b78cc7c95ab19bd9f7e5dccd28ae413 Mon Sep 17 00:00:00 2001 From: Jan Meznaric Date: Thu, 6 Feb 2020 13:36:33 +0100 Subject: [PATCH 03/14] minor edits --- .../languages/JavaJAXRSSpecServerCodegen.java | 2 +- .../spec/libraries/kumuluzee/README.mustache | 36 +++++++++---------- .../libraries/kumuluzee/config.yaml.mustache | 4 +-- .../spec/libraries/kumuluzee/pom.mustache | 8 ++--- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 2cd5d0b8531a..7ff92ef84c4b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -100,7 +100,7 @@ public JavaJAXRSSpecServerCodegen() { supportedLibraries.put(THORNTAIL_LIBRARY, "Server using Thorntail"); supportedLibraries.put(OPEN_LIBERTY_LIBRARY, "Server using Open Liberty"); supportedLibraries.put(HELIDON_LIBRARY, "Server using Helidon"); - supportedLibraries.put(KUMULUZEE_LIBRARY, "Server using Kumuluzee"); + supportedLibraries.put(KUMULUZEE_LIBRARY, "Server using KumuluzEE"); library.setEnum(supportedLibraries); cliOptions.add(library); diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache index b6b483f4e14f..deea381ac94e 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/README.mustache @@ -1,4 +1,4 @@ -# JAX-RS server with OpenAPI using Kumuluzee +# JAX-RS server with OpenAPI using KumuluzEE ## Overview This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an @@ -8,7 +8,7 @@ This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework and the [Eclipse-MicroProfile-OpenAPI](https://github.com/eclipse/microprofile-open-api) addition. -The pom file is configured to use [Kumuluzee](https://ee.kumuluz.com/) as application server. +The pom file is configured to use [KumuluzEE](https://ee.kumuluz.com/) as application server. {{#interfaceOnly}} This project produces a jar that defines some interfaces. @@ -16,27 +16,27 @@ The pom file is configured to use [Kumuluzee](https://ee.kumuluz.com/) as applic {{/interfaceOnly}} {{^interfaceOnly}} - To build the server, run this maven command: +To build the server, run this maven command: - ```bash - mvn clean package - ``` +```bash +mvn clean package +``` - To run the server, run this maven command: +To run the server, run this maven command: - ```bash - java -jar target/${project.build.finalName}.jar - ``` +```bash +java -jar target/${project.build.finalName}.jar +``` - You can then call your server endpoints under: +You can then call your server endpoints under: - ``` - http://localhost:8080 - ``` +``` +http://localhost:8080 +``` - Example endpoint: +Example endpoint: - ``` - http://localhost:8080/v2/user/example - ``` +``` +http://localhost:8080/v2/user/example +``` {{/interfaceOnly}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache index e6a77b619a79..44562fef81ee 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/config.yaml.mustache @@ -1,5 +1,5 @@ kumuluzee: - name: openapi-jaxrs-kumuluzee-server - version: 1.0.0 + name: {{artifactId}} + version: {{artifactVersion}} env: name: dev \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache index 1e59ff4eb285..79f69fd8c6be 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/kumuluzee/pom.mustache @@ -5,11 +5,11 @@ 4.0.0 {{groupId}} - openapi-jaxrs-kumuluzee-server - openapi-jaxrs-kumuluzee-server - 1.0.0-SNAPSHOT + {{artifactId}} + {{artifactVersion}} - jar + Automatically generated KumuluzEE microservice + The microservice was generated automatically with the OpenAPI Generator project 1.8 From 580f666d11d9ba9eb6d4aeb2119b4c6967809ccb Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Sat, 15 Feb 2020 18:18:47 +0100 Subject: [PATCH 04/14] Added new library to Java client codegen (microprofile-kumuluzee). A functional KumuluzEE REST client can now be generated. --- .../codegen/DefaultGenerator.java | 7 + .../codegen/languages/JavaClientCodegen.java | 32 +++-- .../microprofile-kumuluzee/README.mustache | 13 ++ .../microprofile-kumuluzee/api.mustache | 63 +++++++++ .../api_exception.mustache | 23 ++++ .../api_exception_mapper.mustache | 22 +++ .../microprofile-kumuluzee/api_test.mustache | 75 ++++++++++ .../beanValidation.mustache | 4 + .../beanValidationCore.mustache | 20 +++ .../beanValidationHeaderParams.mustache | 1 + .../beanValidationPathParams.mustache | 1 + .../beanValidationQueryParams.mustache | 1 + .../microprofile-kumuluzee/beans.xml.mustache | 5 + .../bodyParams.mustache | 1 + .../bodyParamsImpl.mustache | 1 + .../config.yaml.mustache | 11 ++ .../microprofile-kumuluzee/enumClass.mustache | 33 +++++ .../enumOuterClass.mustache | 48 +++++++ .../formParams.mustache | 1 + .../formParamsImpl.mustache | 1 + .../generatedAnnotation.mustache | 1 + .../headerParams.mustache | 1 + .../headerParamsImpl.mustache | 1 + .../licenseInfo.mustache | 23 ++++ .../microprofile-kumuluzee/model.mustache | 23 ++++ .../pathParams.mustache | 1 + .../pathParamsImpl.mustache | 1 + .../microprofile-kumuluzee/pojo.mustache | 129 ++++++++++++++++++ .../microprofile-kumuluzee/pom.mustache | 114 ++++++++++++++++ .../queryParams.mustache | 1 + .../queryParamsImpl.mustache | 1 + .../returnTypes.mustache | 4 + 32 files changed, 651 insertions(+), 12 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beans.xml.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 774b5159b969..899b1665dc9b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -838,6 +838,13 @@ private Map buildSupportFileBundle(List allOperations, L bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar)); bundle.put("modelPackage", config.modelPackage()); + Set apiClassNames = new HashSet<>(); + for (Object operation : allOperations) { + String classname = (String)(((Map)operation).get("classname")); + apiClassNames.add(config.apiPackage() + "." + classname); + } + bundle.put("apiClassFiles", apiClassNames); + Map securitySchemeMap = openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null; List authMethods = config.fromSecurity(securitySchemeMap); if (authMethods != null && !authMethods.isEmpty()) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 571717ceb27d..dcef9df1f2d3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.GzipFeatures; import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures; @@ -87,6 +88,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String RETROFIT_2 = "retrofit2"; public static final String VERTX = "vertx"; public static final String MICROPROFILE = "microprofile"; + public static final String MICROPROFILE_KUMULUZEE = "microprofile-kumuluzee"; public static final String SERIALIZATION_LIBRARY_GSON = "gson"; public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson"; @@ -163,6 +165,8 @@ public JavaClientCodegen() { supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8"); supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+"); supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x"); + supportedLibraries.put(MICROPROFILE_KUMULUZEE, "HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x Framework: KumuluzEE"); + CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); libraryOption.setEnum(supportedLibraries); @@ -197,7 +201,7 @@ public String getHelp() { @Override public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { super.addOperationToGroup(tag, resourcePath, operation, co, operations); - if (MICROPROFILE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { co.subresourceOperation = !co.path.isEmpty(); } } @@ -207,10 +211,9 @@ public void processOpts() { if ((WEBCLIENT.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) || NATIVE.equals(getLibrary())) { dateLibrary = "java8"; } - else if (MICROPROFILE.equals(getLibrary())) { + else if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { dateLibrary = "legacy"; } - super.processOpts(); // RxJava @@ -295,12 +298,12 @@ else if (MICROPROFILE.equals(getLibrary())) { writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java")); - if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { + if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java")); } // google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer) - if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { + if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); @@ -332,13 +335,13 @@ else if (MICROPROFILE.equals(getLibrary())) { apiDocTemplateFiles.remove("api_doc.mustache"); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java")); supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java")); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); } @@ -413,7 +416,7 @@ else if (MICROPROFILE.equals(getLibrary())) { additionalProperties.put("convert", new CaseFormatLambda(LOWER_CAMEL, UPPER_UNDERSCORE)); apiTemplateFiles.put("api.mustache", ".java"); supportingFiles.add(new SupportingFile("ResponseSpecBuilders.mustache", invokerFolder, "ResponseSpecBuilders.java")); - } else if (MICROPROFILE.equals(getLibrary())) { + } else if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { supportingFiles.clear(); // Don't need extra files provided by Java Codegen String apiExceptionFolder = (sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); @@ -422,6 +425,11 @@ else if (MICROPROFILE.equals(getLibrary())) { supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java")); importMapping.put("LocalDate", "org.joda.time.LocalDate"); serializationLibrary = "none"; + + if (MICROPROFILE_KUMULUZEE.equals(getLibrary())){ + supportingFiles.add(new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); + supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); + } } else { LOGGER.error("Unknown library option (-l/--library): " + getLibrary()); } @@ -584,12 +592,12 @@ public int compare(CodegenParameter one, CodegenParameter another) { } // google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer) - if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) { + if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) { supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java")); supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java")); } - if (MICROPROFILE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { objs = AbstractJavaJAXRSServerCodegen.jaxrsPostProcessOperations(objs); } @@ -682,7 +690,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert model.imports.add("JsonCreator"); } } - if (MICROPROFILE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { model.imports.remove("ApiModelProperty"); model.imports.remove("ApiModel"); model.imports.remove("JsonSerialize"); @@ -692,7 +700,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert @Override public CodegenModel fromModel(String name, Schema model) { CodegenModel codegenModel = super.fromModel(name, model); - if (MICROPROFILE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { if (codegenModel.imports.contains("ApiModel")) { // Remove io.swagger.annotations.ApiModel import codegenModel.imports.remove("ApiModel"); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache new file mode 100644 index 000000000000..d7a396f481f4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache @@ -0,0 +1,13 @@ +# {{appName}} - MicroProfile Rest Client + +{{#appDescriptionWithNewLines}} +{{{appDescriptionWithNewLines}}} + +{{/appDescriptionWithNewLines}} +{{#apiClassNames}} + -class {{.}} +{{/apiClassNames}} +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +[MicroProfile Rest Client](https://github.com/eclipse/microprofile-rest-client) is a type-safe way of calling +REST services. The generated client contains an interface which acts as the client, you can inject it into dependent classes. diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache new file mode 100644 index 000000000000..5cadd81eb33b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache @@ -0,0 +1,63 @@ +{{>licenseInfo}} +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.enterprise.context.Dependent; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +{{^disableMultipart}} +import org.apache.cxf.jaxrs.ext.multipart.*; +{{/disableMultipart}} + +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +{{#appName}} +/** + * {{{appName}}} + * + {{#appDescription}} + *

{{{appDescription}}} + * + {{/appDescription}} + */ +{{/appName}} + +@RegisterRestClient +@Dependent +@RegisterProvider(ApiExceptionMapper.class) +@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}") +public interface {{classname}} { +{{#operations}} +{{#operation}} + + {{#summary}} + /** + * {{summary}} + * + {{#notes}} + * {{notes}} + * + {{/notes}} + */ + {{/summary}} + @{{httpMethod}} + {{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}} +{{#hasConsumes}} + @Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }) +{{/hasConsumes}} +{{#hasProduces}} + @Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }) +{{/hasProduces}} + public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException, ProcessingException; +{{/operation}} +} +{{/operations}} + diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache new file mode 100644 index 000000000000..fc5c5e5000ae --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache @@ -0,0 +1,23 @@ +{{>licenseInfo}} +package {{apiPackage}}; + +import javax.ws.rs.core.Response; + +public class ApiException extends Exception { + + private static final long serialVersionUID = 1L; + private Response response; + + public ApiException() { + super(); + } + + public ApiException(Response response) { + super("Api response has status code " + response.getStatus()); + this.response = response; + } + + public Response getResponse() { + return this.response; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache new file mode 100644 index 000000000000..9c5988414cd3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache @@ -0,0 +1,22 @@ +{{>licenseInfo}} +package {{apiPackage}}; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; + +@Provider +public class ApiExceptionMapper + implements ResponseExceptionMapper { + + @Override + public boolean handles(int status, MultivaluedMap headers) { + return status >= 400; + } + + @Override + public ApiException toThrowable(Response response) { + return new ApiException(response); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache new file mode 100644 index 000000000000..8177ac16dada --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache @@ -0,0 +1,75 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +import java.net.URL; +import java.net.MalformedURLException; +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + + + +/** + {{#appName}} + * {{{appName}}} Test + * + {{/appName}} + * API tests for {{classname}} + */ +{{#generateSpringBootApplication}} +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = SpringBootApplication.class) +@WebAppConfiguration +@IntegrationTest("server.port=0") +{{/generateSpringBootApplication}} +public class {{classname}}Test { + + private {{classname}} client; + private String baseUrl = "http://localhost:9080"; + + @Before + public void setup() throws MalformedURLException { + client = RestClientBuilder.newBuilder() + .baseUrl(new URL(baseUrl)) + .register(ApiException.class) + .build({{classname}}.class); + } + + {{#operations}}{{#operation}} + /** + {{#summary}} + * {{summary}} + * + {{#notes}} + * {{notes}} + * + {{/notes}} + {{/summary}} + * @throws ApiException + * if the Api call fails + */ + @Test + public void {{operationId}}Test() { + // TODO: test validations + {{#allParams}} + {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} + {{/allParams}} + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + //{{#returnType}}assertNotNull(response);{{/returnType}} + + + } + {{/operation}}{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache new file mode 100644 index 000000000000..c8c6946fef66 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache @@ -0,0 +1,4 @@ +{{#required}} + @NotNull +{{/required}} +{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache new file mode 100644 index 000000000000..8bcdce3df16e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache @@ -0,0 +1,20 @@ +{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! +minLength && maxLength set +}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! +minLength set, maxLength not +}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! +minLength not set, maxLength set +}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{! +@Size: minItems && maxItems set +}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{! +@Size: minItems set, maxItems not +}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! +@Size: minItems not set && maxItems set +}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! +check for integer or long / all others=decimal type with @Decimal* +isInteger set +}}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{! +isLong set +}}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{! +Not Integer, not Long => we have a decimal value! +}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache new file mode 100644 index 000000000000..f8eef8f94c7b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache @@ -0,0 +1 @@ +{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache new file mode 100644 index 000000000000..051bd53c0a58 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache @@ -0,0 +1 @@ +{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache new file mode 100644 index 000000000000..f8eef8f94c7b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache @@ -0,0 +1 @@ +{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beans.xml.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beans.xml.mustache new file mode 100644 index 000000000000..29549d01d2c2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beans.xml.mustache @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache new file mode 100644 index 000000000000..be56da7535be --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache new file mode 100644 index 000000000000..c7d1abfe527e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache new file mode 100644 index 000000000000..b09b3a7bc46c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache @@ -0,0 +1,11 @@ +kumuluzee: + server: + http: + port: 8081 + + rest-client: + registrations: + {{#apiClassFiles}} + - class: {{.}} + url: http://localhost:8080/v2 + {{/apiClassFiles}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache new file mode 100644 index 000000000000..5bdcf238a2c1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache @@ -0,0 +1,33 @@ +@XmlType(name="{{datatypeWithEnum}}") +@XmlEnum({{dataType}}.class) +public enum {{datatypeWithEnum}} { + + {{#allowableValues}} +{{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} + {{/allowableValues}} + + + private {{dataType}} value; + + {{datatypeWithEnum}} ({{dataType}} v) { + value = v; + } + + public {{dataType}} value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static {{datatypeWithEnum}} fromValue(String v) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}} + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache new file mode 100644 index 000000000000..df2c72873962 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache @@ -0,0 +1,48 @@ +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +{{/jackson}} + +/** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + */ +public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#gson}} + {{#allowableValues}}{{#enumVars}} + @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/gson}} + {{^gson}} + {{#allowableValues}}{{#enumVars}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/gson}} + + private {{{dataType}}} value; + + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + @Override +{{#jackson}} + @JsonValue +{{/jackson}} + public String toString() { + return String.valueOf(value); + } + +{{#jackson}} + @JsonCreator +{{/jackson}} + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}} + } + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache new file mode 100644 index 000000000000..97216dc1806f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{^isFile}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache new file mode 100644 index 000000000000..2be40e1ddd3d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{^isFile}}{{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache new file mode 100644 index 000000000000..49110fc1ad93 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache new file mode 100644 index 000000000000..4a9009e76a20 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@HeaderParam("{{baseName}}") {{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache new file mode 100644 index 000000000000..bd03573d196e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache new file mode 100644 index 000000000000..d148ab0a4191 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache @@ -0,0 +1,23 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache new file mode 100644 index 000000000000..5272ff094879 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache @@ -0,0 +1,23 @@ +{{>licenseInfo}} +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}} +{{>enumOuterClass}} +{{/isEnum}} +{{^isEnum}} +{{>pojo}} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache new file mode 100644 index 000000000000..9e8455d5ac7b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache new file mode 100644 index 000000000000..6829cf8c7a67 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache @@ -0,0 +1 @@ +{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache new file mode 100644 index 000000000000..a7d3ddb77c1c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache @@ -0,0 +1,129 @@ +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.json.bind.annotation.JsonbProperty; + +{{#withXml}} +@XmlAccessorType(XmlAccessType.FIELD) +{{#hasVars}} @XmlType(name = "{{classname}}", propOrder = + { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} +}){{/hasVars}} +{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}} +{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}} +{{/withXml}} +{{#description}} +/** + * {{{description}}} + **/ +{{/description}} +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { + {{#vars}}{{#isEnum}}{{^isContainer}} +{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} +{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} +{{#withXml}} + @XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}}) +{{/withXml}} +{{#description}} + /** + * {{{description}}} + **/ +{{/description}} +{{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; +{{/isContainer}} +{{^isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; +{{/isContainer}} + {{/vars}} + + {{#vars}} + /** + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ + @JsonbProperty("{{baseName}}") +{{#vendorExtensions.extraAnnotation}} + {{{vendorExtensions.extraAnnotation}}} +{{/vendorExtensions.extraAnnotation}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() { + if ({{name}} == null) { + return null; + } + return {{name}}.value(); + }{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isMapContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{/isMapContainer}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{/isEnum}} + + {{^isReadOnly}} + /** + * Set {{name}} + **/ + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isListContainer}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + this.{{name}}.add({{name}}Item); + return this; + } + {{/isListContainer}} + {{#isMapContainer}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMapContainer}} + {{/isReadOnly}} + + {{/vars}} + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache new file mode 100644 index 000000000000..a55a2ea38007 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache @@ -0,0 +1,114 @@ + + 4.0.0 + + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + 1.0.0-SNAPSHOT + + + 1.8 + 1.8 + UTF-8 + + 3.7.0 + 1.2.3 + 1.3.3 + 3.2.6 + 4.13 + 2.28 + + + + + + com.kumuluz.ee + kumuluzee-bom + ${kumuluzee.version} + pom + import + + + + + + + com.kumuluz.ee + kumuluzee-core + + + com.kumuluz.ee + kumuluzee-servlet-jetty + + + com.kumuluz.ee + kumuluzee-jax-rs-jersey + + + com.kumuluz.ee + kumuluzee-cdi-weld + + + com.kumuluz.ee + kumuluzee-json-p-jsonp + + + com.kumuluz.ee.rest + kumuluzee-rest-core + ${kumuluzee-rest.version} + + + com.kumuluz.ee.rest-client + kumuluzee-rest-client + ${kumuluzee-rest-client.version} + + + org.apache.cxf + cxf-rt-rs-extension-providers + ${cxf-rt-rs-extension-providers.version} + + + javax.activation + activation + 1.1.1 + + + javax.json.bind + javax.json.bind-api + 1.0 + + + junit + junit + ${junit-version} + test + + + org.glassfish.jersey.media + jersey-media-jaxb + ${jersey-version} + + + + + + + com.kumuluz.ee + kumuluzee-maven-plugin + ${kumuluzee.version} + + + package + + repackage + + + + + + + + diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache new file mode 100644 index 000000000000..ca2c6e106f78 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache new file mode 100644 index 000000000000..ff79730471d9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache new file mode 100644 index 000000000000..6af86ffe4e4a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache @@ -0,0 +1,4 @@ +{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response: +}}{{^useGenericResponse}}{{! +}}{{{returnType}}}{{! +}}{{/useGenericResponse}} \ No newline at end of file From 42ada37d58584b0707dde602489c1c7dab839604 Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Sat, 15 Feb 2020 20:15:39 +0100 Subject: [PATCH 05/14] Edited README for microprofile-kumuluzee --- .../microprofile-kumuluzee/README.mustache | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache index d7a396f481f4..9c9b58076283 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache @@ -9,5 +9,24 @@ {{/apiClassNames}} ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. -[MicroProfile Rest Client](https://github.com/eclipse/microprofile-rest-client) is a type-safe way of calling -REST services. The generated client contains an interface which acts as the client, you can inject it into dependent classes. +[KumuluzEE Rest Client](https://github.com/kumuluz/kumuluzee-rest-client) is a type-safe way of calling +REST services implemented in the [KumuluzEE](https://ee.kumuluz.com) framework. The generated client contains an interface which acts as the client, you can inject it into dependent classes. + +To build the client, run this maven command: + +```bash +mvn clean package +``` + +To run the client, run this maven command: + +```bash +java -jar target/${project.build.finalName}.jar +``` + +By default, the client interface is configured to use "localhost:8080/v2" as the server URL (the default URL of the JAX-RS +server generated with this generator). You can change this in the config.yaml file. + +``` +http://localhost:8080/v2 +``` From dc1c3d453eef242e7cead66fbba2c80c96d9e534 Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Fri, 10 Apr 2020 12:59:01 +0200 Subject: [PATCH 06/14] Edited docs to include new KumuluzEE library options. --- docs/generators/java.md | 2 +- docs/generators/jaxrs-spec.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/generators/java.md b/docs/generators/java.md index c97d5e24d4e3..700bec2d64a9 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -28,7 +28,7 @@ sidebar_label: java |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.client| |java8|Option. Use Java8 classes instead of third party equivalents|

**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| -|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
|okhttp-gson| +|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
**microprofile-kumuluzee**
HTTP client: Microprofile client X.x. Framework: [KumuluzEE](https://ee.kumuluz.com) JSON processing: Jackson 2.9.x
|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.client.model| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index efa6474297ba..a211a31b6888 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -29,7 +29,7 @@ sidebar_label: jaxrs-spec |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| -|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
|<default>| +|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
**kumuluzee**
Server using [KumuluzEE](https//ee.kumuluz.com)
|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| From f994dddcb15bb559062a32e368c8b011ffa39fae Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Fri, 10 Apr 2020 16:31:37 +0200 Subject: [PATCH 07/14] Updated kee-rest-client client POM dependency version to latest --- .../Java/libraries/microprofile-kumuluzee/pom.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache index 714de79fbdab..21ecdd8457e9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache @@ -16,7 +16,7 @@ 3.9.0 1.2.3 - 1.3.3 + 1.4.1 3.2.6 4.13 2.28 From 741c2567cec7054025d99b74845644f99eb13f66 Mon Sep 17 00:00:00 2001 From: Jan Meznaric Date: Wed, 15 Apr 2020 13:18:58 +0200 Subject: [PATCH 08/14] fixed pom, edited REAMDE --- .../microprofile-kumuluzee/README.mustache | 23 ++++++++++--------- .../microprofile-kumuluzee/pom.mustache | 4 ++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache index 9c9b58076283..3f1b4227c740 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache @@ -8,9 +8,17 @@ -class {{.}} {{/apiClassNames}} ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. -[KumuluzEE Rest Client](https://github.com/kumuluz/kumuluzee-rest-client) is a type-safe way of calling -REST services implemented in the [KumuluzEE](https://ee.kumuluz.com) framework. The generated client contains an interface which acts as the client, you can inject it into dependent classes. +This client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +It uses the [KumuluzEE](https://ee.kumuluz.com) framework together with the [KumuluzEE Rest Client](https://github.com/kumuluz/kumuluzee-rest-client) +project, which provides a type-safe way of calling REST services. + +The generated client contains a set of interfaces for calling the endpoints defined in the OpenAPI specification. The +interfaces can be injected into dependent classes and its methods can be used to call the REST service's endpoints. +The detailed description on using the KumuluzEE Rest Client can be found +[here](https://github.com/kumuluz/kumuluzee-rest-client/blob/master/README.md). + +By default, the client is configured to use "localhost:8080/v2" as the server URL (the default URL of the JAX-RS +server generated with this generator). You can change this in the config.yaml file. To build the client, run this maven command: @@ -22,11 +30,4 @@ To run the client, run this maven command: ```bash java -jar target/${project.build.finalName}.jar -``` - -By default, the client interface is configured to use "localhost:8080/v2" as the server URL (the default URL of the JAX-RS -server generated with this generator). You can change this in the config.yaml file. - -``` -http://localhost:8080/v2 -``` +``` \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache index 21ecdd8457e9..bf1bf5762452 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache @@ -55,6 +55,10 @@ com.kumuluz.ee kumuluzee-json-p-jsonp + + com.kumuluz.ee + kumuluzee-json-b-yasson + com.kumuluz.ee.rest kumuluzee-rest-core From 6321cead89e2c571d34a9260ee5cbc8a1a624ace Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Wed, 15 Apr 2020 15:08:06 +0200 Subject: [PATCH 09/14] Trimmed redundant dependencies from KEE client pom --- .../microprofile-kumuluzee/pom.mustache | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache index bf1bf5762452..c07307589480 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache @@ -59,11 +59,6 @@ com.kumuluz.ee kumuluzee-json-b-yasson - - com.kumuluz.ee.rest - kumuluzee-rest-core - ${kumuluzee-rest.version} - com.kumuluz.ee.rest-client kumuluzee-rest-client @@ -74,27 +69,12 @@ cxf-rt-rs-extension-providers ${cxf-rt-rs-extension-providers.version} - - javax.activation - activation - 1.1.1 - - - javax.json.bind - javax.json.bind-api - 1.0 - junit junit ${junit-version} test - - org.glassfish.jersey.media - jersey-media-jaxb - ${jersey-version} - From 56fef6deb94140a81ac9a7ca343d2050f0407c55 Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Mon, 20 Apr 2020 16:00:45 +0200 Subject: [PATCH 10/14] Removed unnecessary DefaultGenerator edit, modified config template accordingly. --- .../java/org/openapitools/codegen/DefaultGenerator.java | 7 ------- .../libraries/microprofile-kumuluzee/config.yaml.mustache | 5 ++--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 53439781b82e..e8dab26d05f9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -910,13 +910,6 @@ private Map buildSupportFileBundle(List allOperations, L bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar)); bundle.put("modelPackage", config.modelPackage()); - Set apiClassNames = new HashSet<>(); - for (Object operation : allOperations) { - String classname = (String)(((Map)operation).get("classname")); - apiClassNames.add(config.apiPackage() + "." + classname); - } - bundle.put("apiClassFiles", apiClassNames); - Map securitySchemeMap = openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null; List authMethods = config.fromSecurity(securitySchemeMap); if (authMethods != null && !authMethods.isEmpty()) { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache index b09b3a7bc46c..90f5237eb99c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache @@ -5,7 +5,6 @@ kumuluzee: rest-client: registrations: - {{#apiClassFiles}} - - class: {{.}} + {{#apiInfo}}{{#apis}}{{#operations}}- class: {{{invokerPackage}}}.{{{classname}}} url: http://localhost:8080/v2 - {{/apiClassFiles}} \ No newline at end of file + {{/operations}}{{/apis}}{{/apiInfo}} \ No newline at end of file From 30e381882a2238997528d12090622d861046cc16 Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Thu, 30 Apr 2020 12:36:10 +0200 Subject: [PATCH 11/14] Made mp framework an additional property for microprofile instead of being another library option, removed now redundant library files. --- .../codegen/languages/JavaClientCodegen.java | 52 ++++--- .../microprofile-kumuluzee/README.mustache | 33 ----- .../microprofile-kumuluzee/api.mustache | 63 --------- .../api_exception.mustache | 23 ---- .../api_exception_mapper.mustache | 22 --- .../microprofile-kumuluzee/api_test.mustache | 75 ---------- .../beanValidation.mustache | 4 - .../beanValidationCore.mustache | 20 --- .../beanValidationHeaderParams.mustache | 1 - .../beanValidationPathParams.mustache | 1 - .../beanValidationQueryParams.mustache | 1 - .../bodyParams.mustache | 1 - .../bodyParamsImpl.mustache | 1 - .../microprofile-kumuluzee/enumClass.mustache | 33 ----- .../enumOuterClass.mustache | 48 ------- .../formParams.mustache | 1 - .../formParamsImpl.mustache | 1 - .../generatedAnnotation.mustache | 1 - .../headerParams.mustache | 1 - .../headerParamsImpl.mustache | 1 - .../licenseInfo.mustache | 23 ---- .../microprofile-kumuluzee/model.mustache | 23 ---- .../pathParams.mustache | 1 - .../pathParamsImpl.mustache | 1 - .../microprofile-kumuluzee/pojo.mustache | 129 ------------------ .../queryParams.mustache | 1 - .../queryParamsImpl.mustache | 1 - .../returnTypes.mustache | 4 - .../kumuluzee.beans.xml.mustache} | 0 .../kumuluzee.config.yaml.mustache} | 0 .../kumuluzee.pom.mustache} | 2 +- 31 files changed, 37 insertions(+), 531 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache delete mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache rename modules/openapi-generator/src/main/resources/Java/libraries/{microprofile-kumuluzee/beans.xml.mustache => microprofile/kumuluzee.beans.xml.mustache} (100%) rename modules/openapi-generator/src/main/resources/Java/libraries/{microprofile-kumuluzee/config.yaml.mustache => microprofile/kumuluzee.config.yaml.mustache} (100%) rename modules/openapi-generator/src/main/resources/Java/libraries/{microprofile-kumuluzee/pom.mustache => microprofile/kumuluzee.pom.mustache} (99%) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index c27c7a109ddb..f32024449ee4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -60,6 +60,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders"; + public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework"; public static final String PLAY_24 = "play24"; public static final String PLAY_25 = "play25"; @@ -68,6 +69,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String FEIGN_9 = "9.x"; public static final String FEIGN_10 = "10.x"; + public static final String MICROPROFILE_DEFAULT = "default"; + public static final String MICROPROFILE_KUMULUZEE = "kumuluzee"; + public static final String FEIGN = "feign"; public static final String GOOGLE_API_CLIENT = "google-api-client"; public static final String JERSEY1 = "jersey1"; @@ -82,7 +86,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String RETROFIT_2 = "retrofit2"; public static final String VERTX = "vertx"; public static final String MICROPROFILE = "microprofile"; - public static final String MICROPROFILE_KUMULUZEE = "microprofile-kumuluzee"; public static final String SERIALIZATION_LIBRARY_GSON = "gson"; public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson"; @@ -96,6 +99,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean usePlayWS = false; protected String playVersion = PLAY_25; protected String feignVersion = FEIGN_10; + protected String microprofileFramework = MICROPROFILE_DEFAULT; protected boolean parcelableModel = false; protected boolean useBeanValidation = false; protected boolean performBeanValidation = false; @@ -143,6 +147,7 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newBoolean(FEIGN_VERSION, "Version of OpenFeign: '10.x' (default), '9.x' (deprecated)")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); + cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\"")); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); @@ -158,7 +163,6 @@ public JavaClientCodegen() { supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8"); supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+"); supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x"); - supportedLibraries.put(MICROPROFILE_KUMULUZEE, "HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x Framework: KumuluzEE"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); @@ -194,7 +198,7 @@ public String getHelp() { @Override public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { super.addOperationToGroup(tag, resourcePath, operation, co, operations); - if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary())) { co.subresourceOperation = !co.path.isEmpty(); } } @@ -203,7 +207,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera public void processOpts() { if ((WEBCLIENT.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) || NATIVE.equals(getLibrary())) { dateLibrary = "java8"; - } else if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { + } else if (MICROPROFILE.equals(getLibrary())) { dateLibrary = "legacy"; } super.processOpts(); @@ -250,6 +254,17 @@ public void processOpts() { } additionalProperties.put(FEIGN_VERSION, feignVersion); + // Microprofile framework + if (additionalProperties.containsKey(MICROPROFILE_FRAMEWORK)) { + this.setMicroprofileFramework(additionalProperties.get(MICROPROFILE_FRAMEWORK).toString()); + + if (!MICROPROFILE_KUMULUZEE.equals(microprofileFramework)) { + throw new RuntimeException("Ivalid microprofileFramework '{}'. Must be 'kumuluzee' or none."); + } + + } + additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework); + if (additionalProperties.containsKey(PARCELABLE_MODEL)) { this.setParcelableModel(Boolean.valueOf(additionalProperties.get(PARCELABLE_MODEL).toString())); } @@ -299,12 +314,12 @@ public void processOpts() { supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml")); - if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { + if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java")); } // google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer) - if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { + if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); @@ -336,13 +351,13 @@ public void processOpts() { apiDocTemplateFiles.remove("api_doc.mustache"); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java")); supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java")); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); } @@ -417,7 +432,7 @@ public void processOpts() { additionalProperties.put("convert", new CaseFormatLambda(LOWER_CAMEL, UPPER_UNDERSCORE)); apiTemplateFiles.put("api.mustache", ".java"); supportingFiles.add(new SupportingFile("ResponseSpecBuilders.mustache", invokerFolder, "ResponseSpecBuilders.java")); - } else if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { + } else if (MICROPROFILE.equals(getLibrary())) { supportingFiles.clear(); // Don't need extra files provided by Java Codegen String apiExceptionFolder = (sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); @@ -427,9 +442,10 @@ public void processOpts() { importMapping.put("LocalDate", "org.joda.time.LocalDate"); serializationLibrary = "none"; - if (MICROPROFILE_KUMULUZEE.equals(getLibrary())){ - supportingFiles.add(new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); - supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); + if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)){ + writeOptional(outputFolder, new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("kumuluzee.config.yaml.mustache", "src/main/resources", "config.yaml")); + supportingFiles.add(new SupportingFile("kumuluzee.beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); } } else { LOGGER.error("Unknown library option (-l/--library): " + getLibrary()); @@ -594,12 +610,12 @@ public int compare(CodegenParameter one, CodegenParameter another) { } // google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer) - if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) { + if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) { supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java")); supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java")); } - if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary())) { objs = AbstractJavaJAXRSServerCodegen.jaxrsPostProcessOperations(objs); } @@ -692,7 +708,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert model.imports.add("JsonCreator"); } } - if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary())) { model.imports.remove("ApiModelProperty"); model.imports.remove("ApiModel"); model.imports.remove("JsonSerialize"); @@ -703,7 +719,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert @Override public CodegenModel fromModel(String name, Schema model) { CodegenModel codegenModel = super.fromModel(name, model); - if (MICROPROFILE.equals(getLibrary()) || MICROPROFILE_KUMULUZEE.equals(getLibrary())) { + if (MICROPROFILE.equals(getLibrary())) { if (codegenModel.imports.contains("ApiModel")) { // Remove io.swagger.annotations.ApiModel import codegenModel.imports.remove("ApiModel"); @@ -815,6 +831,10 @@ public void setFeignVersion(String feignVersion) { this.feignVersion = feignVersion; } + public void setMicroprofileFramework(String microprofileFramework) { + this.microprofileFramework = microprofileFramework; + } + public void setParcelableModel(boolean parcelableModel) { this.parcelableModel = parcelableModel; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache deleted file mode 100644 index 3f1b4227c740..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/README.mustache +++ /dev/null @@ -1,33 +0,0 @@ -# {{appName}} - MicroProfile Rest Client - -{{#appDescriptionWithNewLines}} -{{{appDescriptionWithNewLines}}} - -{{/appDescriptionWithNewLines}} -{{#apiClassNames}} - -class {{.}} -{{/apiClassNames}} -## Overview -This client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. -It uses the [KumuluzEE](https://ee.kumuluz.com) framework together with the [KumuluzEE Rest Client](https://github.com/kumuluz/kumuluzee-rest-client) -project, which provides a type-safe way of calling REST services. - -The generated client contains a set of interfaces for calling the endpoints defined in the OpenAPI specification. The -interfaces can be injected into dependent classes and its methods can be used to call the REST service's endpoints. -The detailed description on using the KumuluzEE Rest Client can be found -[here](https://github.com/kumuluz/kumuluzee-rest-client/blob/master/README.md). - -By default, the client is configured to use "localhost:8080/v2" as the server URL (the default URL of the JAX-RS -server generated with this generator). You can change this in the config.yaml file. - -To build the client, run this maven command: - -```bash -mvn clean package -``` - -To run the client, run this maven command: - -```bash -java -jar target/${project.build.finalName}.jar -``` \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache deleted file mode 100644 index 5cadd81eb33b..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api.mustache +++ /dev/null @@ -1,63 +0,0 @@ -{{>licenseInfo}} -package {{package}}; - -{{#imports}}import {{import}}; -{{/imports}} - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import javax.enterprise.context.Dependent; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.MediaType; -{{^disableMultipart}} -import org.apache.cxf.jaxrs.ext.multipart.*; -{{/disableMultipart}} - -import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; -import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; - -{{#appName}} -/** - * {{{appName}}} - * - {{#appDescription}} - *

{{{appDescription}}} - * - {{/appDescription}} - */ -{{/appName}} - -@RegisterRestClient -@Dependent -@RegisterProvider(ApiExceptionMapper.class) -@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}") -public interface {{classname}} { -{{#operations}} -{{#operation}} - - {{#summary}} - /** - * {{summary}} - * - {{#notes}} - * {{notes}} - * - {{/notes}} - */ - {{/summary}} - @{{httpMethod}} - {{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}} -{{#hasConsumes}} - @Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }) -{{/hasConsumes}} -{{#hasProduces}} - @Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }) -{{/hasProduces}} - public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException, ProcessingException; -{{/operation}} -} -{{/operations}} - diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache deleted file mode 100644 index fc5c5e5000ae..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception.mustache +++ /dev/null @@ -1,23 +0,0 @@ -{{>licenseInfo}} -package {{apiPackage}}; - -import javax.ws.rs.core.Response; - -public class ApiException extends Exception { - - private static final long serialVersionUID = 1L; - private Response response; - - public ApiException() { - super(); - } - - public ApiException(Response response) { - super("Api response has status code " + response.getStatus()); - this.response = response; - } - - public Response getResponse() { - return this.response; - } -} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache deleted file mode 100644 index 9c5988414cd3..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_exception_mapper.mustache +++ /dev/null @@ -1,22 +0,0 @@ -{{>licenseInfo}} -package {{apiPackage}}; - -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; -import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; - -@Provider -public class ApiExceptionMapper - implements ResponseExceptionMapper { - - @Override - public boolean handles(int status, MultivaluedMap headers) { - return status >= 400; - } - - @Override - public ApiException toThrowable(Response response) { - return new ApiException(response); - } -} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache deleted file mode 100644 index 8177ac16dada..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/api_test.mustache +++ /dev/null @@ -1,75 +0,0 @@ -{{>licenseInfo}} - -package {{package}}; - -{{#imports}}import {{import}}; -{{/imports}} -import org.junit.Test; -import org.junit.Before; -import static org.junit.Assert.*; - -import org.eclipse.microprofile.rest.client.RestClientBuilder; - -import java.net.URL; -import java.net.MalformedURLException; -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - - - -/** - {{#appName}} - * {{{appName}}} Test - * - {{/appName}} - * API tests for {{classname}} - */ -{{#generateSpringBootApplication}} -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = SpringBootApplication.class) -@WebAppConfiguration -@IntegrationTest("server.port=0") -{{/generateSpringBootApplication}} -public class {{classname}}Test { - - private {{classname}} client; - private String baseUrl = "http://localhost:9080"; - - @Before - public void setup() throws MalformedURLException { - client = RestClientBuilder.newBuilder() - .baseUrl(new URL(baseUrl)) - .register(ApiException.class) - .build({{classname}}.class); - } - - {{#operations}}{{#operation}} - /** - {{#summary}} - * {{summary}} - * - {{#notes}} - * {{notes}} - * - {{/notes}} - {{/summary}} - * @throws ApiException - * if the Api call fails - */ - @Test - public void {{operationId}}Test() { - // TODO: test validations - {{#allParams}} - {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} - {{/allParams}} - //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - //{{#returnType}}assertNotNull(response);{{/returnType}} - - - } - {{/operation}}{{/operations}} -} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache deleted file mode 100644 index c8c6946fef66..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidation.mustache +++ /dev/null @@ -1,4 +0,0 @@ -{{#required}} - @NotNull -{{/required}} -{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache deleted file mode 100644 index 8bcdce3df16e..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationCore.mustache +++ /dev/null @@ -1,20 +0,0 @@ -{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! -minLength && maxLength set -}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! -minLength set, maxLength not -}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! -minLength not set, maxLength set -}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{! -@Size: minItems && maxItems set -}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{! -@Size: minItems set, maxItems not -}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! -@Size: minItems not set && maxItems set -}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! -check for integer or long / all others=decimal type with @Decimal* -isInteger set -}}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{! -isLong set -}}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{! -Not Integer, not Long => we have a decimal value! -}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache deleted file mode 100644 index f8eef8f94c7b..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationHeaderParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache deleted file mode 100644 index 051bd53c0a58..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationPathParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache deleted file mode 100644 index f8eef8f94c7b..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beanValidationQueryParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache deleted file mode 100644 index be56da7535be..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache deleted file mode 100644 index c7d1abfe527e..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/bodyParamsImpl.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache deleted file mode 100644 index 5bdcf238a2c1..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumClass.mustache +++ /dev/null @@ -1,33 +0,0 @@ -@XmlType(name="{{datatypeWithEnum}}") -@XmlEnum({{dataType}}.class) -public enum {{datatypeWithEnum}} { - - {{#allowableValues}} -{{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} - {{/allowableValues}} - - - private {{dataType}} value; - - {{datatypeWithEnum}} ({{dataType}} v) { - value = v; - } - - public {{dataType}} value() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static {{datatypeWithEnum}} fromValue(String v) { - for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { - if (String.valueOf(b.value).equals(v)) { - return b; - } - } - {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}} - } -} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache deleted file mode 100644 index df2c72873962..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/enumOuterClass.mustache +++ /dev/null @@ -1,48 +0,0 @@ -{{#jackson}} -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -{{/jackson}} - -/** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} - */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { - {{#gson}} - {{#allowableValues}}{{#enumVars}} - @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) - {{{name}}}({{{value}}}){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} - {{/gson}} - {{^gson}} - {{#allowableValues}}{{#enumVars}} - {{{name}}}({{{value}}}){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} - {{/gson}} - - private {{{dataType}}} value; - - {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { - this.value = value; - } - - @Override -{{#jackson}} - @JsonValue -{{/jackson}} - public String toString() { - return String.valueOf(value); - } - -{{#jackson}} - @JsonCreator -{{/jackson}} - public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) { - for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}} - } - -} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache deleted file mode 100644 index 97216dc1806f..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isFormParam}}{{^isFile}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache deleted file mode 100644 index 2be40e1ddd3d..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/formParamsImpl.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isFormParam}}{{^isFile}}{{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache deleted file mode 100644 index 49110fc1ad93..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/generatedAnnotation.mustache +++ /dev/null @@ -1 +0,0 @@ -@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache deleted file mode 100644 index 4a9009e76a20..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isHeaderParam}}@HeaderParam("{{baseName}}") {{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache deleted file mode 100644 index bd03573d196e..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/headerParamsImpl.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache deleted file mode 100644 index d148ab0a4191..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/licenseInfo.mustache +++ /dev/null @@ -1,23 +0,0 @@ -/** - * {{{appName}}} - * {{{appDescription}}} - * - * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} - * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache deleted file mode 100644 index 5272ff094879..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/model.mustache +++ /dev/null @@ -1,23 +0,0 @@ -{{>licenseInfo}} -package {{package}}; - -{{#imports}}import {{import}}; -{{/imports}} -{{#serializableModel}} -import java.io.Serializable; -{{/serializableModel}} -{{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; -{{/useBeanValidation}} - -{{#models}} -{{#model}} -{{#isEnum}} -{{>enumOuterClass}} -{{/isEnum}} -{{^isEnum}} -{{>pojo}} -{{/isEnum}} -{{/model}} -{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache deleted file mode 100644 index 9e8455d5ac7b..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache deleted file mode 100644 index 6829cf8c7a67..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pathParamsImpl.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache deleted file mode 100644 index a7d3ddb77c1c..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pojo.mustache +++ /dev/null @@ -1,129 +0,0 @@ -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.json.bind.annotation.JsonbProperty; - -{{#withXml}} -@XmlAccessorType(XmlAccessType.FIELD) -{{#hasVars}} @XmlType(name = "{{classname}}", propOrder = - { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} -}){{/hasVars}} -{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}} -{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}} -{{/withXml}} -{{#description}} -/** - * {{{description}}} - **/ -{{/description}} -public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { - {{#vars}}{{#isEnum}}{{^isContainer}} -{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} -{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} -{{#withXml}} - @XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}}) -{{/withXml}} -{{#description}} - /** - * {{{description}}} - **/ -{{/description}} -{{#isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; -{{/isContainer}} -{{^isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; -{{/isContainer}} - {{/vars}} - - {{#vars}} - /** - {{#description}} - * {{description}} - {{/description}} - {{^description}} - * Get {{name}} - {{/description}} - {{#minimum}} - * minimum: {{minimum}} - {{/minimum}} - {{#maximum}} - * maximum: {{maximum}} - {{/maximum}} - * @return {{name}} - **/ - @JsonbProperty("{{baseName}}") -{{#vendorExtensions.extraAnnotation}} - {{{vendorExtensions.extraAnnotation}}} -{{/vendorExtensions.extraAnnotation}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() { - if ({{name}} == null) { - return null; - } - return {{name}}.value(); - }{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - }{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isMapContainer}}public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - }{{/isMapContainer}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - }{{/isEnum}} - - {{^isReadOnly}} - /** - * Set {{name}} - **/ - public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - } - - public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - return this; - } - {{#isListContainer}} - - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { - this.{{name}}.add({{name}}Item); - return this; - } - {{/isListContainer}} - {{#isMapContainer}} - - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { - this.{{name}}.put(key, {{name}}Item); - return this; - } - {{/isMapContainer}} - {{/isReadOnly}} - - {{/vars}} - - /** - * Create a string representation of this pojo. - **/ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class {{classname}} {\n"); - {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); - {{/vars}}sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private static String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache deleted file mode 100644 index ca2c6e106f78..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache deleted file mode 100644 index ff79730471d9..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/queryParamsImpl.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache deleted file mode 100644 index 6af86ffe4e4a..000000000000 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/returnTypes.mustache +++ /dev/null @@ -1,4 +0,0 @@ -{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response: -}}{{^useGenericResponse}}{{! -}}{{{returnType}}}{{! -}}{{/useGenericResponse}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beans.xml.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.beans.xml.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/beans.xml.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.beans.xml.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.config.yaml.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/config.yaml.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.config.yaml.mustache diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache similarity index 99% rename from modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache rename to modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache index c07307589480..ac235b7edf59 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile-kumuluzee/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache @@ -95,4 +95,4 @@ - + \ No newline at end of file From b0ad1c65e6826cdde2691991904cc57a1d8a6298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Pavi=C5=A1i=C4=8D?= Date: Thu, 30 Apr 2020 13:23:58 +0200 Subject: [PATCH 12/14] Updated documentation with microprofile framework --- docs/generators/java.md | 573 ++++++++++++++++++++-------------------- 1 file changed, 287 insertions(+), 286 deletions(-) diff --git a/docs/generators/java.md b/docs/generators/java.md index 74b11b1716b3..89b7fe385219 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -1,287 +1,288 @@ ---- -title: Config Options for java -sidebar_label: java ---- - -| Option | Description | Values | Default | -| ------ | ----------- | ------ | ------- | -|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| -|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| -|apiPackage|package for generated api classes| |org.openapitools.client.api| -|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java| -|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client| -|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator| -|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| -|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false| -|booleanGetterPrefix|Set booleanGetterPrefix| |get| -|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| -|dateLibrary|Option. Date library to use|

**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date (if you really have a good reason not to use threetenbp
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true
**threetenbp**
Backport of JSR310 (preferred for jdk < 1.8)
|threetenbp| -|developerEmail|developer email in generated pom.xml| |team@openapitools.org| -|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| -|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| -|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| -|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| -|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|feignVersion|Version of OpenFeign: '10.x' (default), '9.x' (deprecated)| |false| -|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false| -|groupId|groupId in generated pom.xml| |org.openapitools| -|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| -|invokerPackage|root package for generated code| |org.openapitools.client| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| -|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
**microprofile-kumuluzee**
HTTP client: Microprofile client X.x. Framework: [KumuluzEE](https://ee.kumuluz.com) JSON processing: Jackson 2.9.x
|okhttp-gson| -|licenseName|The name of the license| |Unlicense| -|licenseUrl|The URL of the license| |http://unlicense.org| -|modelPackage|package for generated models| |org.openapitools.client.model| -|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| -|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| -|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| -|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| -|performBeanValidation|Perform BeanValidation| |false| -|playVersion|Version of Play! Framework (possible values "play24", "play25" (default), "play26")| |null| -|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| -|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| -|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| -|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator| -|serializableModel|boolean - toggle "implements Serializable" for generated models| |false| -|serializationLibrary|Serialization library, default depends from the library|
**jackson**
Use Jackson as serialization library
**gson**
Use Gson as serialization library
|null| -|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null| -|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| -|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| -|sourceFolder|source folder for generated code| |src/main/java| -|supportJava6|Whether to support Java6 with the Jersey1 library.| |false| -|useBeanValidation|Use BeanValidation API annotations| |false| -|useGzipFeature|Send gzip-encoded requests| |false| -|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| -|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false| -|useRuntimeException|Use RuntimeException instead of Exception| |false| -|useRxJava|Whether to use the RxJava adapter with the retrofit2 library.| |false| -|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library.| |false| -|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| - -## IMPORT MAPPING - -| Type/Alias | Imports | -| ---------- | ------- | -|Array|java.util.List| -|ArrayList|java.util.ArrayList| -|BigDecimal|java.math.BigDecimal| -|Date|java.util.Date| -|DateTime|org.joda.time.*| -|File|java.io.File| -|HashMap|java.util.HashMap| -|List|java.util.*| -|LocalDate|org.joda.time.*| -|LocalDateTime|org.joda.time.*| -|LocalTime|org.joda.time.*| -|Map|java.util.Map| -|Set|java.util.*| -|Timestamp|java.sql.Timestamp| -|URI|java.net.URI| -|UUID|java.util.UUID| - - -## INSTANTIATION TYPES - -| Type/Alias | Instantiated By | -| ---------- | --------------- | -|array|ArrayList| -|map|HashMap| - - -## LANGUAGE PRIMITIVES - -
    -
  • Boolean
  • -
  • Double
  • -
  • Float
  • -
  • Integer
  • -
  • Long
  • -
  • Object
  • -
  • String
  • -
  • boolean
  • -
  • byte[]
  • -
- -## RESERVED WORDS - -
    -
  • abstract
  • -
  • apiclient
  • -
  • apiexception
  • -
  • apiresponse
  • -
  • assert
  • -
  • boolean
  • -
  • break
  • -
  • byte
  • -
  • case
  • -
  • catch
  • -
  • char
  • -
  • class
  • -
  • configuration
  • -
  • const
  • -
  • continue
  • -
  • default
  • -
  • do
  • -
  • double
  • -
  • else
  • -
  • enum
  • -
  • extends
  • -
  • final
  • -
  • finally
  • -
  • float
  • -
  • for
  • -
  • goto
  • -
  • if
  • -
  • implements
  • -
  • import
  • -
  • instanceof
  • -
  • int
  • -
  • interface
  • -
  • localreturntype
  • -
  • localvaraccept
  • -
  • localvaraccepts
  • -
  • localvarauthnames
  • -
  • localvarcollectionqueryparams
  • -
  • localvarcontenttype
  • -
  • localvarcontenttypes
  • -
  • localvarcookieparams
  • -
  • localvarformparams
  • -
  • localvarheaderparams
  • -
  • localvarpath
  • -
  • localvarpostbody
  • -
  • localvarqueryparams
  • -
  • long
  • -
  • native
  • -
  • new
  • -
  • null
  • -
  • object
  • -
  • package
  • -
  • private
  • -
  • protected
  • -
  • public
  • -
  • return
  • -
  • short
  • -
  • static
  • -
  • strictfp
  • -
  • stringutil
  • -
  • super
  • -
  • switch
  • -
  • synchronized
  • -
  • this
  • -
  • throw
  • -
  • throws
  • -
  • transient
  • -
  • try
  • -
  • void
  • -
  • volatile
  • -
  • while
  • -
- -## FEATURE SET - - -### Client Modification Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasePath|✓|ToolingExtension -|Authorizations|✗|ToolingExtension -|UserAgent|✗|ToolingExtension - -### Data Type Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Custom|✗|OAS2,OAS3 -|Int32|✓|OAS2,OAS3 -|Int64|✓|OAS2,OAS3 -|Float|✓|OAS2,OAS3 -|Double|✓|OAS2,OAS3 -|Decimal|✓|ToolingExtension -|String|✓|OAS2,OAS3 -|Byte|✓|OAS2,OAS3 -|Binary|✓|OAS2,OAS3 -|Boolean|✓|OAS2,OAS3 -|Date|✓|OAS2,OAS3 -|DateTime|✓|OAS2,OAS3 -|Password|✓|OAS2,OAS3 -|File|✓|OAS2 -|Array|✓|OAS2,OAS3 -|Maps|✓|ToolingExtension -|CollectionFormat|✓|OAS2 -|CollectionFormatMulti|✓|OAS2 -|Enum|✓|OAS2,OAS3 -|ArrayOfEnum|✓|ToolingExtension -|ArrayOfModel|✓|ToolingExtension -|ArrayOfCollectionOfPrimitives|✓|ToolingExtension -|ArrayOfCollectionOfModel|✓|ToolingExtension -|ArrayOfCollectionOfEnum|✓|ToolingExtension -|MapOfEnum|✓|ToolingExtension -|MapOfModel|✓|ToolingExtension -|MapOfCollectionOfPrimitives|✓|ToolingExtension -|MapOfCollectionOfModel|✓|ToolingExtension -|MapOfCollectionOfEnum|✓|ToolingExtension - -### Documentation Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Readme|✓|ToolingExtension -|Model|✓|ToolingExtension -|Api|✓|ToolingExtension - -### Global Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Host|✓|OAS2,OAS3 -|BasePath|✓|OAS2,OAS3 -|Info|✓|OAS2,OAS3 -|Schemes|✗|OAS2,OAS3 -|PartialSchemes|✓|OAS2,OAS3 -|Consumes|✓|OAS2 -|Produces|✓|OAS2 -|ExternalDocumentation|✓|OAS2,OAS3 -|Examples|✓|OAS2,OAS3 -|XMLStructureDefinitions|✗|OAS2,OAS3 -|MultiServer|✗|OAS3 -|ParameterizedServer|✓|OAS3 -|ParameterStyling|✗|OAS3 -|Callbacks|✗|OAS3 -|LinkObjects|✗|OAS3 - -### Parameter Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Path|✓|OAS2,OAS3 -|Query|✓|OAS2,OAS3 -|Header|✓|OAS2,OAS3 -|Body|✓|OAS2 -|FormUnencoded|✓|OAS2 -|FormMultipart|✓|OAS2 -|Cookie|✓|OAS3 - -### Schema Support Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Simple|✓|OAS2,OAS3 -|Composite|✓|OAS2,OAS3 -|Polymorphism|✗|OAS2,OAS3 -|Union|✗|OAS3 - -### Security Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 -|OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 -|OAuth2_Password|✗|OAS2,OAS3 -|OAuth2_ClientCredentials|✗|OAS2,OAS3 -|OAuth2_AuthorizationCode|✗|OAS2,OAS3 - -### Wire Format Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|JSON|✓|OAS2,OAS3 -|XML|✓|OAS2,OAS3 -|PROTOBUF|✗|ToolingExtension +--- +title: Config Options for java +sidebar_label: java +--- + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|apiPackage|package for generated api classes| |org.openapitools.client.api| +|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java| +|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client| +|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator| +|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| +|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false| +|booleanGetterPrefix|Set booleanGetterPrefix| |get| +|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| +|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date (if you really have a good reason not to use threetenbp
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true
**threetenbp**
Backport of JSR310 (preferred for jdk < 1.8)
|threetenbp| +|developerEmail|developer email in generated pom.xml| |team@openapitools.org| +|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| +|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| +|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|feignVersion|Version of OpenFeign: '10.x' (default), '9.x' (deprecated)| |false| +|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false| +|groupId|groupId in generated pom.xml| |org.openapitools| +|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| +|invokerPackage|root package for generated code| |org.openapitools.client| +|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
|okhttp-gson| +|licenseName|The name of the license| |Unlicense| +|licenseUrl|The URL of the license| |http://unlicense.org| +|microprofileFramework|Framework for microprofile|
kumuluzee
use [KumuluzEE](ee.kumuluz.com)
|null| +|modelPackage|package for generated models| |org.openapitools.client.model| +|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| +|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|performBeanValidation|Perform BeanValidation| |false| +|playVersion|Version of Play! Framework (possible values "play24", "play25" (default), "play26")| |null| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| +|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| +|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator| +|serializableModel|boolean - toggle "implements Serializable" for generated models| |false| +|serializationLibrary|Serialization library, default depends from the library|
**jackson**
Use Jackson as serialization library
**gson**
Use Gson as serialization library
|null| +|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|sourceFolder|source folder for generated code| |src/main/java| +|supportJava6|Whether to support Java6 with the Jersey1 library.| |false| +|useBeanValidation|Use BeanValidation API annotations| |false| +|useGzipFeature|Send gzip-encoded requests| |false| +|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| +|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false| +|useRuntimeException|Use RuntimeException instead of Exception| |false| +|useRxJava|Whether to use the RxJava adapter with the retrofit2 library.| |false| +|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library.| |false| +|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | +|Array|java.util.List| +|ArrayList|java.util.ArrayList| +|BigDecimal|java.math.BigDecimal| +|Date|java.util.Date| +|DateTime|org.joda.time.*| +|File|java.io.File| +|HashMap|java.util.HashMap| +|List|java.util.*| +|LocalDate|org.joda.time.*| +|LocalDateTime|org.joda.time.*| +|LocalTime|org.joda.time.*| +|Map|java.util.Map| +|Set|java.util.*| +|Timestamp|java.sql.Timestamp| +|URI|java.net.URI| +|UUID|java.util.UUID| + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|ArrayList| +|map|HashMap| + + +## LANGUAGE PRIMITIVES + +
    +
  • Boolean
  • +
  • Double
  • +
  • Float
  • +
  • Integer
  • +
  • Long
  • +
  • Object
  • +
  • String
  • +
  • boolean
  • +
  • byte[]
  • +
+ +## RESERVED WORDS + +
    +
  • abstract
  • +
  • apiclient
  • +
  • apiexception
  • +
  • apiresponse
  • +
  • assert
  • +
  • boolean
  • +
  • break
  • +
  • byte
  • +
  • case
  • +
  • catch
  • +
  • char
  • +
  • class
  • +
  • configuration
  • +
  • const
  • +
  • continue
  • +
  • default
  • +
  • do
  • +
  • double
  • +
  • else
  • +
  • enum
  • +
  • extends
  • +
  • final
  • +
  • finally
  • +
  • float
  • +
  • for
  • +
  • goto
  • +
  • if
  • +
  • implements
  • +
  • import
  • +
  • instanceof
  • +
  • int
  • +
  • interface
  • +
  • localreturntype
  • +
  • localvaraccept
  • +
  • localvaraccepts
  • +
  • localvarauthnames
  • +
  • localvarcollectionqueryparams
  • +
  • localvarcontenttype
  • +
  • localvarcontenttypes
  • +
  • localvarcookieparams
  • +
  • localvarformparams
  • +
  • localvarheaderparams
  • +
  • localvarpath
  • +
  • localvarpostbody
  • +
  • localvarqueryparams
  • +
  • long
  • +
  • native
  • +
  • new
  • +
  • null
  • +
  • object
  • +
  • package
  • +
  • private
  • +
  • protected
  • +
  • public
  • +
  • return
  • +
  • short
  • +
  • static
  • +
  • strictfp
  • +
  • stringutil
  • +
  • super
  • +
  • switch
  • +
  • synchronized
  • +
  • this
  • +
  • throw
  • +
  • throws
  • +
  • transient
  • +
  • try
  • +
  • void
  • +
  • volatile
  • +
  • while
  • +
+ +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✓|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Array|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✓|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✓|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✗|OAS2,OAS3 +|Union|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✗|OAS2,OAS3 +|ApiKey|✗|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✗|OAS3 +|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✓|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension |Custom|✗|OAS2,OAS3 From 5b2725257b251bdd6740415edf61d5d2131aeb76 Mon Sep 17 00:00:00 2001 From: chuckle-dog Date: Wed, 19 Aug 2020 03:52:23 +0200 Subject: [PATCH 13/14] Fixed errors caused by removed functions and variables --- .../org/openapitools/codegen/languages/JavaClientCodegen.java | 4 +--- .../codegen/languages/JavaJAXRSSpecServerCodegen.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index bd8033198ea7..5610a2ced912 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -97,9 +97,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean doNotUseRx = true; protected boolean usePlayWS = false; protected String playVersion = PLAY_25; - protected String feignVersion = FEIGN_10; protected String microprofileFramework = MICROPROFILE_DEFAULT; - protected String playVersion = PLAY_26; protected boolean asyncNative = false; protected boolean parcelableModel = false; @@ -471,7 +469,7 @@ public void processOpts() { serializationLibrary = "none"; if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)){ - writeOptional(outputFolder, new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml")); supportingFiles.add(new SupportingFile("kumuluzee.config.yaml.mustache", "src/main/resources", "config.yaml")); supportingFiles.add(new SupportingFile("kumuluzee.beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index eedc5340859e..6a05221b6ab6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -219,7 +219,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml") .doNotOverwrite()); } else if(KUMULUZEE_LIBRARY.equals(library)) { - writeOptional(outputFolder, new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); + supportingFiles.add(new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); } } From 203b62fcca729769270860d2899b09ce63d71969 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 19 Aug 2020 15:15:33 +0800 Subject: [PATCH 14/14] update doc --- docs/generators/java.md | 2 +- docs/generators/jaxrs-cxf-cdi.md | 2 +- docs/generators/jaxrs-spec.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/generators/java.md b/docs/generators/java.md index 7273d635fab1..47f6b3669772 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -34,7 +34,7 @@ sidebar_label: java |library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x
|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| -|microprofileFramework|Framework for microprofile|
kumuluzee
use [KumuluzEE](ee.kumuluz.com)
|null| +|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null| |modelPackage|package for generated models| |org.openapitools.client.model| |parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 11b506810493..867313e4725d 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -33,7 +33,7 @@ sidebar_label: jaxrs-cxf-cdi |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
|<default>| +|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
**kumuluzee**
Server using KumuluzEE
|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 7e55b9bbf733..223d908f214a 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -33,7 +33,7 @@ sidebar_label: jaxrs-spec |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
**kumuluzee**
Server using [KumuluzEE](https//ee.kumuluz.com)
|<default>| +|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
**kumuluzee**
Server using KumuluzEE
|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model|