On a SpringBoot application, There is a @RestController, that contains the following api:
@GetMapping("/api")
public SomeDto getMyApi(@RequestParam UUID userId, Pageable pageable) {
return testService.getMyApi(pageable,userId);
}
When calling the api either from a Javascript client app, or from Swagger, the Pageable object is always instantiated with the default values (page:0, size:21). Even when called with the following request generated by Swagger:
.../api?offset=0&pageNumber=3&pageSize=100&userId=2d02a66e-d7b1-49b3-9fe2-5ec4ff3abffc
This is how it looks like when debugging:
What is done wrong here?
Well Swagger is not generating the correct parameters for you. Check this documentation of Spring Data for correct parameter names. If you are using Springfox for Swagger, by the time of writing this answer parameter name problem is an open issue.