forked from loafle/openapi-generator-original
[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:
parent
72de5bc952
commit
ee7927a525
@ -127,7 +127,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|
||||||
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
||||||
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|
||||||
|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false
|
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||||
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
||||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|
||||||
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
||||||
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|
||||||
|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false
|
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||||
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
||||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
public enum VendorExtension {
|
public enum VendorExtension {
|
||||||
|
|
||||||
X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"),
|
X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"),
|
||||||
X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters", "false"),
|
X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.", "false"),
|
||||||
X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"),
|
X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"),
|
||||||
X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""),
|
X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""),
|
||||||
X_SETTER_EXTRA_ANNOTATION("x-setter-extra-annotation", ExtensionLevel.FIELD, "Custom annotation that can be specified over java setter for specific field", "When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value"),
|
X_SETTER_EXTRA_ANNOTATION("x-setter-extra-annotation", ExtensionLevel.FIELD, "Custom annotation that can be specified over java setter for specific field", "When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value"),
|
||||||
|
@ -996,6 +996,8 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
* Add dynamic imports based on the parameters and vendor extensions of an operation.
|
* Add dynamic imports based on the parameters and vendor extensions of an operation.
|
||||||
* The imports are expanded by the mustache {{import}} tag available to model and api
|
* The imports are expanded by the mustache {{import}} tag available to model and api
|
||||||
* templates.
|
* templates.
|
||||||
|
*
|
||||||
|
* #8315 Also handles removing 'size', 'page' and 'sort' query parameters if using 'x-spring-paginated'.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List<Server> servers) {
|
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List<Server> servers) {
|
||||||
@ -1023,6 +1025,15 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) {
|
if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) {
|
||||||
codegenOperation.imports.add("ParameterObject");
|
codegenOperation.imports.add("ParameterObject");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #8315 Spring Data Web default query params recognized by Pageable
|
||||||
|
List<String> defaultPageableQueryParams = new ArrayList<>(
|
||||||
|
Arrays.asList("page", "size", "sort")
|
||||||
|
);
|
||||||
|
|
||||||
|
// #8315 Remove matching Spring Data Web default query params if 'x-spring-paginated' with Pageable is used
|
||||||
|
codegenOperation.queryParams.removeIf(param -> defaultPageableQueryParams.contains(param.baseName));
|
||||||
|
codegenOperation.allParams.removeIf(param -> param.isQueryParam && defaultPageableQueryParams.contains(param.baseName));
|
||||||
}
|
}
|
||||||
if (codegenOperation.vendorExtensions.containsKey("x-spring-provide-args") && !provideArgsClassSet.isEmpty()) {
|
if (codegenOperation.vendorExtensions.containsKey("x-spring-provide-args") && !provideArgsClassSet.isEmpty()) {
|
||||||
codegenOperation.imports.addAll(provideArgsClassSet);
|
codegenOperation.imports.addAll(provideArgsClassSet);
|
||||||
|
@ -137,6 +137,31 @@ paths:
|
|||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
collectionFormat: csv
|
collectionFormat: csv
|
||||||
|
- name: size
|
||||||
|
in: header
|
||||||
|
description: 'A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
- name: size
|
||||||
|
in: query
|
||||||
|
description: 'The number of items to return per page. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.'
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
default: 20
|
||||||
|
- name: page
|
||||||
|
in: query
|
||||||
|
description: 'The page to return, starting with page 0. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.'
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
minimum: 0
|
||||||
|
default: 0
|
||||||
|
- name: sort
|
||||||
|
in: query
|
||||||
|
description: 'The sorting to apply to the Pageable object. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: id,asc
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: successful operation
|
description: successful operation
|
||||||
|
@ -133,6 +133,31 @@ paths:
|
|||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
collectionFormat: csv
|
collectionFormat: csv
|
||||||
|
- name: size
|
||||||
|
in: header
|
||||||
|
description: 'A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
- name: size
|
||||||
|
in: query
|
||||||
|
description: 'The number of items to return per page. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.'
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
default: 20
|
||||||
|
- name: page
|
||||||
|
in: query
|
||||||
|
description: 'The page to return, starting with page 0. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.'
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
minimum: 0
|
||||||
|
default: 0
|
||||||
|
- name: sort
|
||||||
|
in: query
|
||||||
|
description: 'The sorting to apply to the Pageable object. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: id,asc
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: successful operation
|
description: successful operation
|
||||||
|
@ -171,6 +171,38 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
|
||||||
|
\ x-spring-paginated:true is used."
|
||||||
|
in: header
|
||||||
|
name: size
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- description: "The number of items to return per page. Test QueryParam for\
|
||||||
|
\ issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||||
|
in: query
|
||||||
|
name: size
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
default: 20
|
||||||
|
minimum: 1
|
||||||
|
type: integer
|
||||||
|
- description: "The page to return, starting with page 0. Test QueryParam for\
|
||||||
|
\ issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||||
|
in: query
|
||||||
|
name: page
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
default: 0
|
||||||
|
minimum: 0
|
||||||
|
type: integer
|
||||||
|
- description: "The sorting to apply to the Pageable object. Test QueryParam\
|
||||||
|
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||||
|
in: query
|
||||||
|
name: sort
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
default: "id,asc"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: successful operation
|
description: successful operation
|
||||||
|
@ -136,6 +136,38 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
|
||||||
|
\ x-spring-paginated:true is used."
|
||||||
|
in: header
|
||||||
|
name: size
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- description: "The number of items to return per page. Test QueryParam for\
|
||||||
|
\ issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||||
|
in: query
|
||||||
|
name: size
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
default: 20
|
||||||
|
minimum: 1
|
||||||
|
type: integer
|
||||||
|
- description: "The page to return, starting with page 0. Test QueryParam for\
|
||||||
|
\ issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||||
|
in: query
|
||||||
|
name: page
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
default: 0
|
||||||
|
minimum: 0
|
||||||
|
type: integer
|
||||||
|
- description: "The sorting to apply to the Pageable object. Test QueryParam\
|
||||||
|
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
|
||||||
|
in: query
|
||||||
|
name: sort
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
default: "id,asc"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: successful operation
|
description: successful operation
|
||||||
|
@ -135,6 +135,7 @@ public interface PetApi {
|
|||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -165,6 +166,7 @@ public interface PetApi {
|
|||||||
)
|
)
|
||||||
ResponseEntity<List<Pet>> findPetsByTags(
|
ResponseEntity<List<Pet>> findPetsByTags(
|
||||||
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
@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
|
@ApiIgnore final Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ public interface PetApi {
|
|||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -168,6 +169,7 @@ public interface PetApi {
|
|||||||
|
|
||||||
ResponseEntity<List<Pet>> findPetsByTags(
|
ResponseEntity<List<Pet>> findPetsByTags(
|
||||||
@NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
@NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
||||||
|
@Parameter(name = "size", description = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.", in = ParameterIn.HEADER) @RequestHeader(value = "size", required = false) String size,
|
||||||
@ParameterObject final Pageable pageable
|
@ParameterObject final Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@ public interface PetApi {
|
|||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -179,9 +180,10 @@ public interface PetApi {
|
|||||||
|
|
||||||
default ResponseEntity<List<Pet>> findPetsByTags(
|
default ResponseEntity<List<Pet>> findPetsByTags(
|
||||||
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
@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
|
@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.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see PetApi#findPetsByTags
|
* @see PetApi#findPetsByTags
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@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 -> {
|
getRequest().ifPresent(request -> {
|
||||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
|
@ -189,6 +189,47 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
style: form
|
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:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
content:
|
content:
|
||||||
|
@ -148,6 +148,7 @@ public interface PetApi {
|
|||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -179,9 +180,10 @@ public interface PetApi {
|
|||||||
|
|
||||||
default ResponseEntity<List<Pet>> findPetsByTags(
|
default ResponseEntity<List<Pet>> findPetsByTags(
|
||||||
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
@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
|
@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.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see PetApi#findPetsByTags
|
* @see PetApi#findPetsByTags
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@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 -> {
|
getRequest().ifPresent(request -> {
|
||||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
|
@ -189,6 +189,47 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
style: form
|
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:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
content:
|
content:
|
||||||
|
@ -169,6 +169,7 @@ public interface PetApi {
|
|||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -200,6 +201,7 @@ public interface PetApi {
|
|||||||
|
|
||||||
default ResponseEntity<List<Pet>> findPetsByTags(
|
default ResponseEntity<List<Pet>> findPetsByTags(
|
||||||
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
@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
|
@ApiIgnore final Pageable pageable
|
||||||
) {
|
) {
|
||||||
getRequest().ifPresent(request -> {
|
getRequest().ifPresent(request -> {
|
||||||
|
@ -189,6 +189,47 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
style: form
|
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:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
content:
|
content:
|
||||||
|
@ -169,6 +169,7 @@ public interface PetApi {
|
|||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
*
|
*
|
||||||
* @param tags Tags to filter by (required)
|
* @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)
|
* @return successful operation (status code 200)
|
||||||
* or Invalid tag value (status code 400)
|
* or Invalid tag value (status code 400)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -200,6 +201,7 @@ public interface PetApi {
|
|||||||
|
|
||||||
default ResponseEntity<List<Pet>> findPetsByTags(
|
default ResponseEntity<List<Pet>> findPetsByTags(
|
||||||
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
|
@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
|
@ApiIgnore final Pageable pageable
|
||||||
) {
|
) {
|
||||||
getRequest().ifPresent(request -> {
|
getRequest().ifPresent(request -> {
|
||||||
|
@ -189,6 +189,47 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
style: form
|
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:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
content:
|
content:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user