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][Spring] fix Spring RequestMapping #9900

Merged
merged 4 commits into from
Jul 27, 2021
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 @@ -120,7 +120,8 @@ public interface {{classname}} {
{{/headerParams}}
})
{{/implicitHeaders}}
@{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Mapping(
@RequestMapping(
method = RequestMethod.{{httpMethod}},
value = "{{{path}}}"{{#singleContentTypes}}{{#hasProduces}},
produces = "{{{vendorExtensions.x-accepts}}}"{{/hasProduces}}{{#hasConsumes}},
consumes = "{{{vendorExtensions.x-contentType}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public interface {{classname}} {
{{#headerParams}}{{>implicitHeader}}{{/headerParams}}
})
{{/implicitHeaders}}
@{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Mapping(
@RequestMapping(
method = RequestMethod.{{httpMethod}},
value = "{{{path}}}"{{#singleContentTypes}},
produces = "{{{vendorExtensions.x-accepts}}}",
consumes = "{{{vendorExtensions.x-contentType}}}"{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}]{{/hasAuthMethods}})
@ApiResponses(
value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}]){{/swaggerAnnotations}}
@{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Mapping(
@RequestMapping(
method = [RequestMethod.{{httpMethod}}],
value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"]{{#singleContentTypes}}{{#hasProduces}},
produces = "{{{vendorExtensions.x-accepts}}}"{{/hasProduces}}{{#hasConsumes}},
consumes = "{{{vendorExtensions.x-contentType}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ interface {{classname}} {
authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}]{{/hasAuthMethods}})
@ApiResponses(
value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}]){{/swaggerAnnotations}}
@{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}Mapping(
@RequestMapping(
method = [RequestMethod.{{httpMethod}}],
value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"]{{#singleContentTypes}}{{#hasProduces}},
produces = "{{{vendorExtensions.x-accepts}}}"{{/hasProduces}}{{#hasConsumes}},
consumes = "{{{vendorExtensions.x-contentType}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,15 @@ paths:
responses:
default:
description: successful operation
options:
tags:
- user
summary: logoutUserOptions
description: ''
operationId: logoutUserOptions
responses:
default:
description: endpoint configuration response
'/user/{username}':
get:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/pet",
consumes = "application/json"
)
Expand All @@ -62,7 +63,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@DeleteMapping(
@RequestMapping(
method = RequestMethod.DELETE,
value = "/pet/{petId}"
)
CompletableFuture<ResponseEntity<Void>> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey);
Expand All @@ -84,7 +86,8 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Invalid status value") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/pet/findByStatus",
produces = "application/json"
)
Expand All @@ -108,7 +111,8 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Invalid tag value") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/pet/findByTags",
produces = "application/json"
)
Expand All @@ -132,7 +136,8 @@ public interface PetApi {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Pet not found") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/pet/{petId}",
produces = "application/json"
)
Expand All @@ -156,7 +161,8 @@ public interface PetApi {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Pet not found"),
@ApiResponse(code = 405, message = "Validation exception") })
@PutMapping(
@RequestMapping(
method = RequestMethod.PUT,
value = "/pet",
consumes = "application/json"
)
Expand All @@ -178,7 +184,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/pet/{petId}",
consumes = "application/x-www-form-urlencoded"
)
Expand All @@ -200,7 +207,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/pet/{petId}/uploadImage",
produces = "application/json",
consumes = "multipart/form-data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public interface StoreApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Order not found") })
@DeleteMapping(
@RequestMapping(
method = RequestMethod.DELETE,
value = "/store/order/{orderId}"
)
CompletableFuture<ResponseEntity<Void>> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("orderId") String orderId);
Expand All @@ -58,7 +59,8 @@ public interface StoreApi {
}, tags={ "store", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/store/inventory",
produces = "application/json"
)
Expand All @@ -79,7 +81,8 @@ public interface StoreApi {
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Order not found") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/store/order/{orderId}",
produces = "application/json"
)
Expand All @@ -97,7 +100,8 @@ public interface StoreApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid Order") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/store/order",
produces = "application/json"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public interface UserApi {
@ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/user"
)
CompletableFuture<ResponseEntity<Void>> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
Expand All @@ -53,7 +54,8 @@ public interface UserApi {
@ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/user/createWithArray"
)
CompletableFuture<ResponseEntity<Void>> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
Expand All @@ -68,7 +70,8 @@ public interface UserApi {
@ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/user/createWithList"
)
CompletableFuture<ResponseEntity<Void>> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
Expand All @@ -86,7 +89,8 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") })
@DeleteMapping(
@RequestMapping(
method = RequestMethod.DELETE,
value = "/user/{username}"
)
CompletableFuture<ResponseEntity<Void>> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username);
Expand All @@ -105,7 +109,8 @@ public interface UserApi {
@ApiResponse(code = 200, message = "successful operation", response = User.class),
@ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/user/{username}",
produces = "application/json"
)
Expand All @@ -124,7 +129,8 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/user/login",
produces = "application/json"
)
Expand All @@ -139,7 +145,8 @@ public interface UserApi {
@ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/user/logout"
)
CompletableFuture<ResponseEntity<Void>> logoutUser();
Expand All @@ -158,7 +165,8 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied"),
@ApiResponse(code = 404, message = "User not found") })
@PutMapping(
@RequestMapping(
method = RequestMethod.PUT,
value = "/user/{username}"
)
CompletableFuture<ResponseEntity<Void>> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/pet",
consumes = "application/json"
)
Expand All @@ -61,7 +62,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@DeleteMapping(
@RequestMapping(
method = RequestMethod.DELETE,
value = "/pet/{petId}"
)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey);
Expand All @@ -83,7 +85,8 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Invalid status value") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/pet/findByStatus",
produces = "application/json"
)
Expand All @@ -107,7 +110,8 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Invalid tag value") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/pet/findByTags",
produces = "application/json"
)
Expand All @@ -131,7 +135,8 @@ public interface PetApi {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Pet not found") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/pet/{petId}",
produces = "application/json"
)
Expand All @@ -155,7 +160,8 @@ public interface PetApi {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Pet not found"),
@ApiResponse(code = 405, message = "Validation exception") })
@PutMapping(
@RequestMapping(
method = RequestMethod.PUT,
value = "/pet",
consumes = "application/json"
)
Expand All @@ -177,7 +183,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/pet/{petId}",
consumes = "application/x-www-form-urlencoded"
)
Expand All @@ -199,7 +206,8 @@ public interface PetApi {
}, tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/pet/{petId}/uploadImage",
produces = "application/json",
consumes = "multipart/form-data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public interface StoreApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Order not found") })
@DeleteMapping(
@RequestMapping(
method = RequestMethod.DELETE,
value = "/store/order/{orderId}"
)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("orderId") String orderId);
Expand All @@ -57,7 +58,8 @@ public interface StoreApi {
}, tags={ "store", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/store/inventory",
produces = "application/json"
)
Expand All @@ -78,7 +80,8 @@ public interface StoreApi {
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Order not found") })
@GetMapping(
@RequestMapping(
method = RequestMethod.GET,
value = "/store/order/{orderId}",
produces = "application/json"
)
Expand All @@ -96,7 +99,8 @@ public interface StoreApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid Order") })
@PostMapping(
@RequestMapping(
method = RequestMethod.POST,
value = "/store/order",
produces = "application/json"
)
Expand Down
Loading