Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][jaxrs-spec] Make contextPath template parameter available as a string constant for use in @ApplicationPath #13377

Merged
merged 6 commits into from
Oct 3, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ public void processOpts() {
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")
.doNotOverwrite());
supportingFiles.add(new SupportingFile("RestResourceRoot.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestResourceRoot.java")
.doNotOverwrite());

if (generatePom) {
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")
.doNotOverwrite());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package {{invokerPackage}};
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package {{invokerPackage}};

public class RestResourceRoot {
public static final String APPLICATION_PATH = "{{{contextPath}}}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ src/gen/java/org/openapitools/api/AnotherFakeApi.java
src/gen/java/org/openapitools/api/FakeApi.java
src/gen/java/org/openapitools/api/FakeClassnameTestApi.java
src/gen/java/org/openapitools/api/PetApi.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/AdditionalPropertiesAnyType.java
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0-SNAPSHOT
6.1.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson-version>2.9.9</jackson-version>
<junit-version>4.13.2</junit-version>
<joda-version>2.10.13</joda-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

@Path("/another-fake/dummy")
@Api(description = "the another-fake API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface AnotherFakeApi {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public interface AnotherFakeApi {

@PATCH
@Consumes({ "application/json" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

@Path("/fake")
@Api(description = "the fake API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface FakeApi {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public interface FakeApi {

@POST
@Path("/create_xml_item")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

@Path("/fake_classname_test")
@Api(description = "the fake_classname_test API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface FakeClassnameTestApi {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public interface FakeClassnameTestApi {

@PATCH
@Consumes({ "application/json" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

@Path("/pet")
@Api(description = "the pet API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface PetApi {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public interface PetApi {

@POST
@Consumes({ "application/json", "application/xml" })
Expand Down
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 @@ -16,7 +16,8 @@

@Path("/store")
@Api(description = "the store API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface StoreApi {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public interface StoreApi {

@DELETE
@Path("/order/{order_id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

@Path("/user")
@Api(description = "the user API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface UserApi {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public interface UserApi {

@POST
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", tags={ "user" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@


@JsonTypeName("AdditionalPropertiesAnyType")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public class AdditionalPropertiesAnyType extends HashMap<String, Object> implements Serializable {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> implements Serializable {
private @Valid String name;

/**
Expand All @@ -30,8 +30,6 @@ public AdditionalPropertiesAnyType name(String name) {
}




@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@


@JsonTypeName("AdditionalPropertiesArray")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public class AdditionalPropertiesArray extends HashMap<String, List> implements Serializable {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public class AdditionalPropertiesArray extends HashMap<String, List> implements Serializable {
private @Valid String name;

/**
Expand All @@ -31,8 +31,6 @@ public AdditionalPropertiesArray name(String name) {
}




@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@


@JsonTypeName("AdditionalPropertiesBoolean")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implements Serializable {
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implements Serializable {
private @Valid String name;

/**
Expand All @@ -30,8 +30,6 @@ public AdditionalPropertiesBoolean name(String name) {
}




@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
Expand Down
Loading