mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 02:57:04 +00:00
[Java][Spring] remove 'size', 'page' and 'sort' query params if using 'x-spring-paginated' (#8315) (#21016)
* [Java][Spring] remove 'size', 'page' and 'sort' query params if using 'x-spring-paginated' (#8315) * Properly implement samples, fixing build issues --------- Co-authored-by: Tobias Fischer <t.fischer@goldflam.de>
This commit is contained in:
@@ -148,6 +148,7 @@ public interface PetApi {
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @param tags Tags to filter by (required)
|
||||
* @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional)
|
||||
* @return successful operation (status code 200)
|
||||
* or Invalid tag value (status code 400)
|
||||
* @deprecated
|
||||
@@ -179,9 +180,10 @@ public interface PetApi {
|
||||
|
||||
default ResponseEntity<List<Pet>> findPetsByTags(
|
||||
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
||||
@ApiParam(value = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size,
|
||||
@ApiIgnore final Pageable pageable
|
||||
) {
|
||||
return getDelegate().findPetsByTags(tags, pageable);
|
||||
return getDelegate().findPetsByTags(tags, size, pageable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,13 +89,15 @@ public interface PetApiDelegate {
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @param tags Tags to filter by (required)
|
||||
* @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional)
|
||||
* @return successful operation (status code 200)
|
||||
* or Invalid tag value (status code 400)
|
||||
* @deprecated
|
||||
* @see PetApi#findPetsByTags
|
||||
*/
|
||||
@Deprecated
|
||||
default ResponseEntity<List<Pet>> findPetsByTags(List<String> tags, final Pageable pageable) {
|
||||
default ResponseEntity<List<Pet>> findPetsByTags(List<String> tags,
|
||||
String size, final Pageable pageable) {
|
||||
getRequest().ifPresent(request -> {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
|
||||
@@ -189,6 +189,47 @@ paths:
|
||||
type: string
|
||||
type: array
|
||||
style: form
|
||||
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
|
||||
\ x-spring-paginated:true is used."
|
||||
explode: false
|
||||
in: header
|
||||
name: size
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
- description: "The number of items to return per page. Test QueryParam for\
|
||||
\ issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||
explode: true
|
||||
in: query
|
||||
name: size
|
||||
required: true
|
||||
schema:
|
||||
default: 20
|
||||
minimum: 1
|
||||
type: integer
|
||||
style: form
|
||||
- description: "The page to return, starting with page 0. Test QueryParam for\
|
||||
\ issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||
explode: true
|
||||
in: query
|
||||
name: page
|
||||
required: true
|
||||
schema:
|
||||
default: 0
|
||||
minimum: 0
|
||||
type: integer
|
||||
style: form
|
||||
- description: "The sorting to apply to the Pageable object. Test QueryParam\
|
||||
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||
explode: true
|
||||
in: query
|
||||
name: sort
|
||||
required: true
|
||||
schema:
|
||||
default: "id,asc"
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
|
||||
Reference in New Issue
Block a user