springfox: Swagger UI unwrapping Spring Data `Pageable` with wrong field names
My controller is the following:
@GetMapping
public ResponseEntity getAll(final @PageableDefault(sort = "id") Pageable pageable) {
return ResponseEntity.ok(null);
}
The resulting Swagger UI is:

It looks like it uses the Pageable getters to infer those parameters, bypassing springfox-data-rest configuration. Am I doing something wrong?
I am using Spring Boot 1.5.10.RELEASE and Springfox 2.9.2 with these dependencies:
<springfox-swagger2.version>2.9.2</springfox-swagger2.version>
[...]
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-core</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spi</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-web</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-data-rest</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 17
- Comments: 29 (4 by maintainers)
Would be nice to have this feature.
What I came up a while ago was
and in the controller:
Hi, I can confirm this issue (with version 2.9.2). In the meantime I have solved it by providing implicit params (as shown below)
You don’t need to place annotation in each function:
I used @hannes-angst
@ApiPageableand it works for me. I just have to add@ApiIgnoreon myPageableparameter though.As workaround, if you’re not using spring-data-rest plus
@Import(SpringDataRestConfiguration.class), you can register anAlternateTypeRulethat’s doing the same as pageableConvension in the swagger configuration:@ArchangelX360 you’re right that it should work, but the only for spring data rest. For spring mvc, it isnt natively supported. Will add support in the upcoming release.
Interesting note: the
nameanddefaultValueare not the same for every Spring project, they are dynamic because they can be configured.e.g.
For some strange reason i was getting a
io.swagger.models.parameters.AbstractSerializableParameter - Illegal DefaultValue for parameter type integerbecause of thedataType="int"anddefaultValue="0"so i changed the dataType todataType="integer"like below and the error doesn’t show up:Not sure if this is a bug or something
Any update? 😃
No updates on this bug?
Hi,
Is there any update on this issue? Still seeing the original issue
Thanks
I just ran into this as well. Subscribing to the issue so I know when it’s been fixed.
@ArchangelX360 Yep, definitely a
bugmissing feature. Btw. be careful this could break the schema generation (I ran into this issue with the@ApiImplicitParamannotation) - see #2204