Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/generators/jaxrs-cxf-cdi.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|generateBuilders|Whether to generate builders for models| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generatePom|Whether to generate pom.xml if the file does not already exist.| |true|
|generateRootResources|Whether to generate the root resource and application classes, only useful if interfaceOnly is true.| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/jaxrs-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generateJsonCreator|Whether to generate @JsonCreator constructor for required properties.| |true|
|generatePom|Whether to generate pom.xml if the file does not already exist.| |true|
|generateRootResources|Whether to generate the root resource and application classes, only useful if interfaceOnly is true.| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public static final String RETURN_RESPONSE = "returnResponse";
public static final String RETURN_JBOSS_RESPONSE = "returnJBossResponse";
public static final String GENERATE_POM = "generatePom";
public static final String GENERATE_ROOT_RESOURCES = "generateRootResources";
public static final String USE_SWAGGER_ANNOTATIONS = "useSwaggerAnnotations";
public static final String USE_MICROPROFILE_OPENAPI_ANNOTATIONS = "useMicroProfileOpenAPIAnnotations";
public static final String USE_SWAGGER_V3_ANNOTATIONS = "useSwaggerV3Annotations";
Expand All @@ -69,6 +70,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public static final String KUMULUZEE_LIBRARY = "kumuluzee";

private boolean interfaceOnly = false;
private boolean generateRootResources = true;
private boolean returnResponse = false;
private boolean returnJbossResponse = false;
private boolean generatePom = true;
Expand Down Expand Up @@ -156,6 +158,7 @@ public JavaJAXRSSpecServerCodegen() {
cliOptions.add(library);
cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom)));
cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, INTERFACE_ONLY_DESC).defaultValue(String.valueOf(interfaceOnly)));
cliOptions.add(CliOption.newBoolean(GENERATE_ROOT_RESOURCES, "Whether to generate the root resource and application classes, only useful if interfaceOnly is true.", generateRootResources));
cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse)));
cliOptions.add(CliOption.newBoolean(RETURN_JBOSS_RESPONSE, "Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. This flag cannot be combined with `returnResponse` flag. It requires the flag `interfaceOnly` and `useJakartaEE` set to true, because `org.jboss.resteasy.reactive.RestResponse` was introduced in Quarkus 2.x").defaultValue(String.valueOf(returnJbossResponse)));
cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations));
Expand All @@ -175,6 +178,7 @@ public void processOpts() {
convertPropertyToBooleanAndWriteBack(GENERATE_POM, value -> generatePom = value);

convertPropertyToBooleanAndWriteBack(INTERFACE_ONLY, value -> interfaceOnly = value);
convertPropertyToBooleanAndWriteBack(GENERATE_ROOT_RESOURCES, value -> generateRootResources = value);
convertPropertyToBooleanAndWriteBack(RETURN_RESPONSE, value -> returnResponse = value);
convertPropertyToBooleanAndWriteBack(RETURN_JBOSS_RESPONSE, value -> returnJbossResponse = value);
convertPropertyToBooleanAndWriteBack(SUPPORT_ASYNC, this::setSupportAsync);
Expand Down Expand Up @@ -251,7 +255,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")
.doNotOverwrite());

if (!interfaceOnly) {
if ((!interfaceOnly) || generateRootResources) {
supportingFiles.add(new SupportingFile("RestResourceRoot.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestResourceRoot.java")
.doNotOverwrite());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
README.md
pom.xml
src/gen/java/org/openapitools/api/PetApi.java
src/gen/java/org/openapitools/api/RestApplication.java
src/gen/java/org/openapitools/api/RestResourceRoot.java
src/gen/java/org/openapitools/api/StoreApi.java
src/gen/java/org/openapitools/api/UserApi.java
src/gen/java/org/openapitools/model/Category.java
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.openapitools.api;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath(RestResourceRoot.APPLICATION_PATH)
public class RestApplication extends Application {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.openapitools.api;

public class RestResourceRoot {
public static final String APPLICATION_PATH = "/v2";
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
README.md
pom.xml
src/gen/java/org/openapitools/api/PetApi.java
src/gen/java/org/openapitools/api/RestApplication.java
src/gen/java/org/openapitools/api/RestResourceRoot.java
src/gen/java/org/openapitools/api/StoreApi.java
src/gen/java/org/openapitools/api/UserApi.java
src/gen/java/org/openapitools/model/Category.java
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.openapitools.api;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath(RestResourceRoot.APPLICATION_PATH)
public class RestApplication extends Application {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.openapitools.api;

public class RestResourceRoot {
public static final String APPLICATION_PATH = "/v2";
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ src/gen/java/org/openapitools/api/AdminOrUserApi.java
src/gen/java/org/openapitools/api/AnonymousOrAuthenticatedApi.java
src/gen/java/org/openapitools/api/AuthenticatedApi.java
src/gen/java/org/openapitools/api/PublicApi.java
src/gen/java/org/openapitools/api/RestApplication.java
src/gen/java/org/openapitools/api/RestResourceRoot.java
src/main/docker/Dockerfile.jvm
src/main/docker/Dockerfile.native
src/main/resources/META-INF/openapi.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.openapitools.api;

import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

@ApplicationPath(RestResourceRoot.APPLICATION_PATH)
public class RestApplication extends Application {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.openapitools.api;

public class RestResourceRoot {
public static final String APPLICATION_PATH = "";
}
Loading