diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 78d31c8573d4..65def9116833 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -46,7 +46,7 @@ sidebar_label: jaxrs-cxf-cdi |title|a title describing the application| |OpenAPI Server| |useBeanValidation|Use BeanValidation API annotations| |true| |serverPort|The port on which the server should be started| |8080| -|library|library template (sub-template)|
**<default>**
JAXRS
|<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
|<default>| |generatePom|Whether to generate pom.xml if the file does not already exist.| |true| |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.| |false| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 8d338ebfef85..1bf741aad866 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -46,7 +46,7 @@ sidebar_label: jaxrs-spec |title|a title describing the application| |OpenAPI Server| |useBeanValidation|Use BeanValidation API annotations| |true| |serverPort|The port on which the server should be started| |8080| -|library|library template (sub-template)|
**<default>**
JAXRS
|<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
|<default>| |generatePom|Whether to generate pom.xml if the file does not already exist.| |true| |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.| |false| 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 42251432c293..bb969ae172c1 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 @@ -17,19 +17,23 @@ package org.openapitools.codegen.languages; +import static org.openapitools.codegen.utils.StringUtils.camelize; + import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.Schema; + import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.*; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.SupportingFile; import java.io.File; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import static org.openapitools.codegen.utils.StringUtils.camelize; - public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String INTERFACE_ONLY = "interfaceOnly"; @@ -39,6 +43,11 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String JACKSON = "jackson"; public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation"; + public static final String QUARKUS_LIBRARY = "quarkus"; + public static final String THORNTAIL_LIBRARY = "thorntail"; + public static final String OPEN_LIBERTY_LIBRARY = "openliberty"; + public static final String HELIDON_LIBRARY = "helidon"; + private boolean interfaceOnly = false; private boolean returnResponse = false; private boolean generatePom = true; @@ -84,8 +93,11 @@ public JavaJAXRSSpecServerCodegen() { removeOption(CodegenConstants.LIBRARY); CliOption library = new CliOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC).defaultValue(DEFAULT_LIBRARY); - Map supportedLibraries = new LinkedHashMap<>(); - supportedLibraries.put(DEFAULT_LIBRARY, "JAXRS"); + supportedLibraries.put(DEFAULT_LIBRARY, "JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)"); + supportedLibraries.put(QUARKUS_LIBRARY, "Server using Quarkus"); + supportedLibraries.put(THORNTAIL_LIBRARY, "Server using Thorntail"); + supportedLibraries.put(OPEN_LIBERTY_LIBRARY, "Server using Open Liberty"); + supportedLibraries.put(HELIDON_LIBRARY, "Server using Helidon"); library.setEnum(supportedLibraries); cliOptions.add(library); @@ -113,12 +125,20 @@ public void processOpts() { additionalProperties.remove(RETURN_RESPONSE); } } - if (additionalProperties.containsKey(USE_SWAGGER_ANNOTATIONS)) { - useSwaggerAnnotations = Boolean.valueOf(additionalProperties.get(USE_SWAGGER_ANNOTATIONS).toString()); + if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library)) { + useSwaggerAnnotations = false; + } else { + if (additionalProperties.containsKey(USE_SWAGGER_ANNOTATIONS)) { + useSwaggerAnnotations = Boolean.valueOf(additionalProperties.get(USE_SWAGGER_ANNOTATIONS).toString()); + } } 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)) { + openApiSpecFileLocation = "src/main/resources/META-INF/openapi.yaml"; + } else if(OPEN_LIBERTY_LIBRARY.equals(library)) { + openApiSpecFileLocation = "src/main/webapp/META-INF/openapi.yaml"; } additionalProperties.put(OPEN_API_SPEC_FILE_LOCATION, openApiSpecFileLocation); @@ -154,6 +174,26 @@ public void processOpts() { } supportingFiles.add(new SupportingFile("openapi.mustache", fileFolder, fileName)); } + + if(QUARKUS_LIBRARY.equals(library)) { + writeOptional(outputFolder, new SupportingFile("application.properties.mustache", "src/main/resources", "application.properties")); + + writeOptional(outputFolder, new SupportingFile("Dockerfile.jvm.mustache", "src/main/docker", "Dockerfile.jvm")); + writeOptional(outputFolder, new SupportingFile("Dockerfile.native.mustache", "src/main/docker", "Dockerfile.native")); + writeOptional(outputFolder, new SupportingFile("dockerignore.mustache", "", ".dockerignore")); + } else if(OPEN_LIBERTY_LIBRARY.equals(library)) { + writeOptional(outputFolder, new SupportingFile("server.xml.mustache", "src/main/liberty/config", "server.xml")); + + writeOptional(outputFolder, new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml")); + writeOptional(outputFolder, new SupportingFile("MANIFEST.MF.mustache", "src/main/webapp/META-INF", "MANIFEST.MF")); + writeOptional(outputFolder, new SupportingFile("microprofile-config.properties.mustache", "src/main/webapp/META-INF", "microprofile-config.properties")); + + writeOptional(outputFolder, new SupportingFile("ibm-web-ext.xml.mustache", "src/main/webapp/WEB-INF", "ibm-web-ext.xml")); + } else if(HELIDON_LIBRARY.equals(library)) { + 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")); + } } @Override diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache new file mode 100644 index 000000000000..1f328b17165e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache @@ -0,0 +1,43 @@ +# JAX-RS server with OpenAPI using Helidon + +## 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 [Helidon](https://helidon.io/) 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 package +``` + +To run the server, run this maven command: + +```bash +mvn exec:java +``` + +You can then call your server endpoints under: + +``` +http://localhost:8080/ +``` + +You can access the OpenAPI specification at: + +``` +http://localhost:8080/openapi +``` + +{{/interfaceOnly}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/beans.xml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/beans.xml.mustache new file mode 100644 index 000000000000..125ef995e5ee --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/beans.xml.mustache @@ -0,0 +1,9 @@ + + + + diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache new file mode 100644 index 000000000000..25a7c650954c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache @@ -0,0 +1,24 @@ +# Example Logging Configuration File +# For more information see $JAVA_HOME/jre/lib/logging.properties + +# Send messages to the console +handlers=java.util.logging.ConsoleHandler + +# Global default logging level. Can be overriden by specific handlers and loggers +.level=INFO + +# Helidon Web Server has a custom log formatter that extends SimpleFormatter. +# It replaces "!thread!" with the current thread name +java.util.logging.ConsoleHandler.level=INFO +java.util.logging.ConsoleHandler.formatter=io.helidon.webserver.WebServerLogFormatter +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n + +#Component specific log levels +#io.helidon.webserver.level=INFO +#io.helidon.config.level=INFO +#io.helidon.security.level=INFO +#io.helidon.microprofile.level=INFO +#io.helidon.common.level=INFO +#io.netty.level=INFO +#org.glassfish.jersey.level=INFO +#org.jboss.weld=INFO diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache new file mode 100644 index 000000000000..1780a159b0a0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache @@ -0,0 +1,6 @@ +# Microprofile server properties +server.port=8080 +server.host=0.0.0.0 + +# Microprofile OpenAPI properties +mp.openapi.scan.disable=true \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache new file mode 100644 index 000000000000..a1e9d0a3d2e0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache @@ -0,0 +1,110 @@ + + + + 4.0.0 + + {{groupId}} + {{artifactId}} + {{artifactVersion}} + + + io.helidon.microprofile.server.Main + 1.2.0 + 3.8.1 + 1.6.0 + 1.0.6 + 3.0.2 + 1.1.2 + 2.29 + 1.2.0 + 5.1.0 + + + + + + org.jboss.jandex + jandex-maven-plugin + ${version.plugin.jandex} + + + make-index + + jandex + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${version.plugin.jar} + + + + true + ${mainClass} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${version.plugin.compiler} + + 1.8 + 1.8 + + -Xlint:unchecked + + + + + org.codehaus.mojo + exec-maven-plugin + ${version.plugin.exec} + + ${mainClass} + + + + + + + + io.helidon.microprofile.bundles + helidon-microprofile-2.2 + ${version.lib.helidon} + + + org.eclipse.microprofile.openapi + microprofile-openapi-api + ${version.lib.microprofile-openapi-api} + + + org.glassfish.jersey.media + jersey-media-json-binding + ${version.lib.jersey} + runtime + + + javax.activation + javax.activation-api + ${version.lib.activation-api} + runtime + + + org.junit.jupiter + junit-jupiter-api + ${version.lib.junit} + test + + + org.junit.jupiter + junit-jupiter-engine + ${version.lib.junit} + test + + + diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/MANIFEST.MF.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/MANIFEST.MF.mustache new file mode 100644 index 000000000000..e3c07ab38a4e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/MANIFEST.MF.mustache @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Class-Path: diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/README.mustache new file mode 100644 index 000000000000..f3389b0ef037 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/README.mustache @@ -0,0 +1,43 @@ +# JAX-RS server with OpenAPI using Open Liberty + +## 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 [Open Liberty](https://openliberty.io/) 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 start the server with maven, run this command: + +```bash +mvn install liberty:start-server +``` + +The OpenAPI specification is available at: + +``` +http://localhost:9080/openapi +``` + +A UI for this OpenAPI Specification is available at: + +``` +http://localhost:9080/openapi/ui +``` + +When you are done stop Open Liberty with: + +``` +mvn liberty:stop-server +``` + +{{/interfaceOnly}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/beans.xml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/beans.xml.mustache new file mode 100644 index 000000000000..17d17df35c24 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/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/openliberty/ibm-web-ext.xml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/ibm-web-ext.xml.mustache new file mode 100644 index 000000000000..91f366873234 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/ibm-web-ext.xml.mustache @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/microprofile-config.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/microprofile-config.properties.mustache new file mode 100644 index 000000000000..c3fe390239c8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/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/openliberty/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache new file mode 100644 index 000000000000..ac16c4257709 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache @@ -0,0 +1,116 @@ + + 4.0.0 + + + net.wasdev.wlp.maven.parent + liberty-maven-app-parent + 2.6 + + + {{groupId}} + {{artifactId}} + {{artifactVersion}} + war + + + + javax + javaee-api + 8.0 + provided + + + org.eclipse.microprofile + microprofile + 2.0.1 + pom + provided + + + javax.validation + validation-api + 2.0.1.Final + + + com.fasterxml.jackson.core + jackson-annotations + 2.0.1 + + + + + 1.8 + 1.8 + false + 3.2.2 + + 19.0.0.7 + 9080 + 9443 + usr + ${project.artifactId} + ${project.build.directory}/${app.name}.zip + + + + {{artifactId}} + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${version.maven-war-plugin} + + false + pom.xml + + + + + + net.wasdev.wlp.maven.plugins + liberty-maven-plugin + + + io.openliberty + openliberty-runtime + ${version.openliberty-runtime} + zip + + OpenAPIGeneratorServer + true + src/main/liberty/config/server.xml + true + ${package.file} + ${packaging.type} + + ${http.port} + ${https.port} + ${app.name} + + + + + + diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/server.xml.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/server.xml.mustache new file mode 100644 index 000000000000..176088c512db --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/server.xml.mustache @@ -0,0 +1,19 @@ + + + cdi-2.0 + jaxrs-2.1 + mpOpenAPI-1.1 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.jvm.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.jvm.mustache new file mode 100644 index 000000000000..fa97e4b11720 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.jvm.mustache @@ -0,0 +1,22 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the docker image run: +# +# mvn package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm +# +### +FROM fabric8/java-alpine-openjdk8-jre +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV AB_ENABLED=jmx_exporter +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/app.jar +ENTRYPOINT [ "/deployments/run-java.sh" ] \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache new file mode 100644 index 000000000000..426c99b81a13 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/Dockerfile.native.mustache @@ -0,0 +1,22 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode +# +# Before building the docker image run: +# +# mvn package -Pnative -Dnative-image.docker-build=true +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/getting-started . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal +WORKDIR /work/ +COPY target/*-runner /work/application +RUN chmod 775 /work +EXPOSE 8080 +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/README.mustache new file mode 100644 index 000000000000..90433afce82b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/README.mustache @@ -0,0 +1,39 @@ +# JAX-RS server with OpenAPI using Quarkus + +## 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 [Quarkus](https://quarkus.io/) 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 start the server in dev mode, run this maven command: + +```bash +mvn compile quarkus:dev +``` + +You can then call your server endpoints under: + +``` +http://localhost:8080/ +``` + +In dev-mode, you can open Swagger-UI at: + +``` +http://localhost:8080/swagger-ui/ +``` + +Read more in the [Quarkus OpenAPI guide](https://quarkus.io/guides/openapi-swaggerui-guide). + +{{/interfaceOnly}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/application.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/application.properties.mustache new file mode 100644 index 000000000000..cef6b5176182 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/application.properties.mustache @@ -0,0 +1,3 @@ +# Configuration file + +mp.openapi.scan.disable=true \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/dockerignore.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/dockerignore.mustache new file mode 100644 index 000000000000..b86c7ac34057 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/dockerignore.mustache @@ -0,0 +1,4 @@ +* +!target/*-runner +!target/*-runner.jar +!target/lib/* \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache new file mode 100644 index 000000000000..265b492d2c04 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache @@ -0,0 +1,138 @@ + + + 4.0.0 + {{groupId}} + {{artifactId}} + {{artifactId}} + {{artifactVersion}} + + UTF-8 + 2.22.0 + 0.22.0 + UTF-8 + 1.8 + 1.8 + + + + + io.quarkus + quarkus-bom + ${quarkus.version} + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + io.quarkus + quarkus-smallrye-openapi + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + build + + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + + + + + + + + native + + + native + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + native-image + + + true + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + + + + + + + + + + diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/thorntail/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/thorntail/README.mustache new file mode 100644 index 000000000000..64d4830d4b8b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/thorntail/README.mustache @@ -0,0 +1,37 @@ +# JAX-RS server with OpenAPI using Thorntail + +## 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 [Thorntail](https://thorntail.io) 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 start the server with maven, run this command: + +```bash +mvn thorntail:run +``` + +You can then call your server endpoints under: + +``` +http://localhost:8080/ +``` + +The OpenAPI specification is available at: + +``` +http://localhost:8080/openapi +``` + +{{/interfaceOnly}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/thorntail/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/thorntail/pom.mustache new file mode 100644 index 000000000000..39e3e37a9655 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/thorntail/pom.mustache @@ -0,0 +1,81 @@ + + + 4.0.0 + {{groupId}} + {{artifactId}} + {{artifactId}} + {{artifactVersion}} + war + + 2.5.0.Final + 4.8.1 + 1.8 + 1.8 + false + UTF-8 + + + + + io.thorntail + bom-all + ${version.thorntail} + import + pom + + + + + + io.thorntail + jaxrs + + + io.thorntail + microprofile-openapi + + + junit + junit + ${version.junit} + test + + + + {{artifactId}} + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + io.thorntail + thorntail-maven-plugin + ${version.thorntail} + + + + package + + + + + + +