Skip to content

Commit 2afe7d2

Browse files
authored
[Spring] Remove unnecessary modifiers from API interface templates (#22132)
* public static final String PATH_ * regenerate samples
1 parent 6ede03d commit 2afe7d2

File tree

194 files changed

+1188
-1188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+1188
-1188
lines changed

modules/openapi-generator/src/main/resources/JavaSpring/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public interface {{classname}} {
132132
{{/jdk8-default-interface}}
133133
{{#operation}}
134134

135-
public static final String PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} = "{{{path}}}";
135+
String PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} = "{{{path}}}";
136136
/**
137137
* {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}}
138138
{{#notes}}

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ public void testRequestMappingAnnotation() throws IOException {
11711171
// Check that the @RequestMapping annotation is generated in the Api file
11721172
JavaFileAssert.assertThat(files.get("PetApi.java"))
11731173
.fileContains("@RequestMapping(\"${openapi.openAPIPetstore.base-path:/v2}\")",
1174-
"public static final String PATH_ADD_PET = \"/pet\";",
1174+
"String PATH_ADD_PET = \"/pet\";",
11751175
"value = PetApi.PATH_ADD_PET");
11761176

11771177
// Check that the @RequestMapping annotation is not generated in the Controller file

samples/client/petstore/spring-cloud-auth/src/main/java/org/openapitools/api/SomeApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
@Validated
2222
public interface SomeApi {
2323

24-
public static final String PATH_SOME_ENDPOINT_GET = "/some/endpoint";
24+
String PATH_SOME_ENDPOINT_GET = "/some/endpoint";
2525
/**
2626
* GET /some/endpoint
2727
*

samples/client/petstore/spring-cloud-date-time/src/main/java/org/openapitools/api/DefaultApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@Api(value = "Default", description = "the Default API")
2828
public interface DefaultApi {
2929

30-
public static final String PATH_GET = "/thingy/{date}";
30+
String PATH_GET = "/thingy/{date}";
3131
/**
3232
* GET /thingy/{date}
3333
*
@@ -57,7 +57,7 @@ ResponseEntity<Void> get(
5757
);
5858

5959

60-
public static final String PATH_UPDATE_PET_WITH_FORM = "/thingy/{date}";
60+
String PATH_UPDATE_PET_WITH_FORM = "/thingy/{date}";
6161
/**
6262
* POST /thingy/{date}
6363
* update with form data

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/PetApi.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@Tag(name = "pet", description = "Everything about your Pets")
3838
public interface PetApi {
3939

40-
public static final String PATH_ADD_PET = "/pet";
40+
String PATH_ADD_PET = "/pet";
4141
/**
4242
* POST /pet : Add a new pet to the store
4343
*
@@ -67,7 +67,7 @@ ResponseEntity<Void> addPet(
6767
);
6868

6969

70-
public static final String PATH_DELETE_PET = "/pet/{petId}";
70+
String PATH_DELETE_PET = "/pet/{petId}";
7171
/**
7272
* DELETE /pet/{petId} : Deletes a pet
7373
*
@@ -98,7 +98,7 @@ ResponseEntity<Void> deletePet(
9898
);
9999

100100

101-
public static final String PATH_FIND_PETS_BY_STATUS = "/pet/findByStatus";
101+
String PATH_FIND_PETS_BY_STATUS = "/pet/findByStatus";
102102
/**
103103
* GET /pet/findByStatus : Finds Pets by status
104104
* Multiple status values can be provided with comma separated strings
@@ -133,7 +133,7 @@ ResponseEntity<List<Pet>> findPetsByStatus(
133133
);
134134

135135

136-
public static final String PATH_FIND_PETS_BY_TAGS = "/pet/findByTags";
136+
String PATH_FIND_PETS_BY_TAGS = "/pet/findByTags";
137137
/**
138138
* GET /pet/findByTags : Finds Pets by tags
139139
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@@ -171,7 +171,7 @@ ResponseEntity<List<Pet>> findPetsByTags(
171171
);
172172

173173

174-
public static final String PATH_GET_PET_BY_ID = "/pet/{petId}";
174+
String PATH_GET_PET_BY_ID = "/pet/{petId}";
175175
/**
176176
* GET /pet/{petId} : Find pet by ID
177177
* Returns a single pet
@@ -208,7 +208,7 @@ ResponseEntity<Pet> getPetById(
208208
);
209209

210210

211-
public static final String PATH_UPDATE_PET = "/pet";
211+
String PATH_UPDATE_PET = "/pet";
212212
/**
213213
* PUT /pet : Update an existing pet
214214
*
@@ -242,7 +242,7 @@ ResponseEntity<Void> updatePet(
242242
);
243243

244244

245-
public static final String PATH_UPDATE_PET_WITH_FORM = "/pet/{petId}";
245+
String PATH_UPDATE_PET_WITH_FORM = "/pet/{petId}";
246246
/**
247247
* POST /pet/{petId} : Updates a pet in the store with form data
248248
*
@@ -276,7 +276,7 @@ ResponseEntity<Void> updatePetWithForm(
276276
);
277277

278278

279-
public static final String PATH_UPLOAD_FILE = "/pet/{petId}/uploadImage";
279+
String PATH_UPLOAD_FILE = "/pet/{petId}/uploadImage";
280280
/**
281281
* POST /pet/{petId}/uploadImage : uploads an image
282282
*

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/StoreApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@Tag(name = "store", description = "Access to Petstore orders")
3737
public interface StoreApi {
3838

39-
public static final String PATH_DELETE_ORDER = "/store/order/{orderId}";
39+
String PATH_DELETE_ORDER = "/store/order/{orderId}";
4040
/**
4141
* DELETE /store/order/{orderId} : Delete purchase order by ID
4242
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@@ -64,7 +64,7 @@ ResponseEntity<Void> deleteOrder(
6464
);
6565

6666

67-
public static final String PATH_GET_INVENTORY = "/store/inventory";
67+
String PATH_GET_INVENTORY = "/store/inventory";
6868
/**
6969
* GET /store/inventory : Returns pet inventories by status
7070
* Returns a map of status codes to quantities
@@ -95,7 +95,7 @@ ResponseEntity<Map<String, Integer>> getInventory(
9595
);
9696

9797

98-
public static final String PATH_GET_ORDER_BY_ID = "/store/order/{orderId}";
98+
String PATH_GET_ORDER_BY_ID = "/store/order/{orderId}";
9999
/**
100100
* GET /store/order/{orderId} : Find purchase order by ID
101101
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
@@ -129,7 +129,7 @@ ResponseEntity<Order> getOrderById(
129129
);
130130

131131

132-
public static final String PATH_PLACE_ORDER = "/store/order";
132+
String PATH_PLACE_ORDER = "/store/order";
133133
/**
134134
* POST /store/order : Place an order for a pet
135135
*

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/UserApi.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@Tag(name = "user", description = "Operations about user")
3737
public interface UserApi {
3838

39-
public static final String PATH_CREATE_USER = "/user";
39+
String PATH_CREATE_USER = "/user";
4040
/**
4141
* POST /user : Create user
4242
* This can only be done by the logged in user.
@@ -66,7 +66,7 @@ ResponseEntity<Void> createUser(
6666
);
6767

6868

69-
public static final String PATH_CREATE_USERS_WITH_ARRAY_INPUT = "/user/createWithArray";
69+
String PATH_CREATE_USERS_WITH_ARRAY_INPUT = "/user/createWithArray";
7070
/**
7171
* POST /user/createWithArray : Creates list of users with given input array
7272
*
@@ -96,7 +96,7 @@ ResponseEntity<Void> createUsersWithArrayInput(
9696
);
9797

9898

99-
public static final String PATH_CREATE_USERS_WITH_LIST_INPUT = "/user/createWithList";
99+
String PATH_CREATE_USERS_WITH_LIST_INPUT = "/user/createWithList";
100100
/**
101101
* POST /user/createWithList : Creates list of users with given input array
102102
*
@@ -126,7 +126,7 @@ ResponseEntity<Void> createUsersWithListInput(
126126
);
127127

128128

129-
public static final String PATH_DELETE_USER = "/user/{username}";
129+
String PATH_DELETE_USER = "/user/{username}";
130130
/**
131131
* DELETE /user/{username} : Delete user
132132
* This can only be done by the logged in user.
@@ -157,7 +157,7 @@ ResponseEntity<Void> deleteUser(
157157
);
158158

159159

160-
public static final String PATH_GET_USER_BY_NAME = "/user/{username}";
160+
String PATH_GET_USER_BY_NAME = "/user/{username}";
161161
/**
162162
* GET /user/{username} : Get user by user name
163163
*
@@ -191,7 +191,7 @@ ResponseEntity<User> getUserByName(
191191
);
192192

193193

194-
public static final String PATH_LOGIN_USER = "/user/login";
194+
String PATH_LOGIN_USER = "/user/login";
195195
/**
196196
* GET /user/login : Logs user into the system
197197
*
@@ -225,7 +225,7 @@ ResponseEntity<String> loginUser(
225225
);
226226

227227

228-
public static final String PATH_LOGOUT_USER = "/user/logout";
228+
String PATH_LOGOUT_USER = "/user/logout";
229229
/**
230230
* GET /user/logout : Logs out current logged in user session
231231
*
@@ -253,7 +253,7 @@ ResponseEntity<Void> logoutUser(
253253
);
254254

255255

256-
public static final String PATH_UPDATE_USER = "/user/{username}";
256+
String PATH_UPDATE_USER = "/user/{username}";
257257
/**
258258
* PUT /user/{username} : Updated user
259259
* This can only be done by the logged in user.

samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/PetApi.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@Api(value = "pet", description = "Everything about your Pets")
2727
public interface PetApi {
2828

29-
public static final String PATH_ADD_PET = "/pet";
29+
String PATH_ADD_PET = "/pet";
3030
/**
3131
* POST /pet : Add a new pet to the store
3232
*
@@ -63,7 +63,7 @@ ResponseEntity<Pet> addPet(
6363
);
6464

6565

66-
public static final String PATH_DELETE_PET = "/pet/{petId}";
66+
String PATH_DELETE_PET = "/pet/{petId}";
6767
/**
6868
* DELETE /pet/{petId} : Deletes a pet
6969
*
@@ -97,7 +97,7 @@ ResponseEntity<Void> deletePet(
9797
);
9898

9999

100-
public static final String PATH_FIND_PETS_BY_STATUS = "/pet/findByStatus";
100+
String PATH_FIND_PETS_BY_STATUS = "/pet/findByStatus";
101101
/**
102102
* GET /pet/findByStatus : Finds Pets by status
103103
* Multiple status values can be provided with comma separated strings
@@ -133,7 +133,7 @@ ResponseEntity<List<Pet>> findPetsByStatus(
133133
);
134134

135135

136-
public static final String PATH_FIND_PETS_BY_TAGS = "/pet/findByTags";
136+
String PATH_FIND_PETS_BY_TAGS = "/pet/findByTags";
137137
/**
138138
* GET /pet/findByTags : Finds Pets by tags
139139
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@@ -171,7 +171,7 @@ ResponseEntity<List<Pet>> findPetsByTags(
171171
);
172172

173173

174-
public static final String PATH_GET_PET_BY_ID = "/pet/{petId}";
174+
String PATH_GET_PET_BY_ID = "/pet/{petId}";
175175
/**
176176
* GET /pet/{petId} : Find pet by ID
177177
* Returns a single pet
@@ -206,7 +206,7 @@ ResponseEntity<Pet> getPetById(
206206
);
207207

208208

209-
public static final String PATH_UPDATE_PET = "/pet";
209+
String PATH_UPDATE_PET = "/pet";
210210
/**
211211
* PUT /pet : Update an existing pet
212212
*
@@ -249,7 +249,7 @@ ResponseEntity<Pet> updatePet(
249249
);
250250

251251

252-
public static final String PATH_UPDATE_PET_WITH_FORM = "/pet/{petId}";
252+
String PATH_UPDATE_PET_WITH_FORM = "/pet/{petId}";
253253
/**
254254
* POST /pet/{petId} : Updates a pet in the store with form data
255255
*
@@ -286,7 +286,7 @@ ResponseEntity<Void> updatePetWithForm(
286286
);
287287

288288

289-
public static final String PATH_UPLOAD_FILE = "/pet/{petId}/uploadImage";
289+
String PATH_UPLOAD_FILE = "/pet/{petId}/uploadImage";
290290
/**
291291
* POST /pet/{petId}/uploadImage : uploads an image
292292
*

samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/StoreApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@Api(value = "store", description = "Access to Petstore orders")
2626
public interface StoreApi {
2727

28-
public static final String PATH_DELETE_ORDER = "/store/order/{orderId}";
28+
String PATH_DELETE_ORDER = "/store/order/{orderId}";
2929
/**
3030
* DELETE /store/order/{orderId} : Delete purchase order by ID
3131
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@@ -53,7 +53,7 @@ ResponseEntity<Void> deleteOrder(
5353
);
5454

5555

56-
public static final String PATH_GET_INVENTORY = "/store/inventory";
56+
String PATH_GET_INVENTORY = "/store/inventory";
5757
/**
5858
* GET /store/inventory : Returns pet inventories by status
5959
* Returns a map of status codes to quantities
@@ -84,7 +84,7 @@ ResponseEntity<Map<String, Integer>> getInventory(
8484
);
8585

8686

87-
public static final String PATH_GET_ORDER_BY_ID = "/store/order/{orderId}";
87+
String PATH_GET_ORDER_BY_ID = "/store/order/{orderId}";
8888
/**
8989
* GET /store/order/{orderId} : Find purchase order by ID
9090
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
@@ -116,7 +116,7 @@ ResponseEntity<Order> getOrderById(
116116
);
117117

118118

119-
public static final String PATH_PLACE_ORDER = "/store/order";
119+
String PATH_PLACE_ORDER = "/store/order";
120120
/**
121121
* POST /store/order : Place an order for a pet
122122
*

0 commit comments

Comments
 (0)