springfox icon indicating copy to clipboard operation
springfox copied to clipboard

springfox-data-rest : Pageable not supported

Open tooms4444 opened this issue 10 years ago • 4 comments

Module: springfox-data-rest Version: 2.6.1

Pageable parameters, correctly handled by Spring Data REST, are ignored in the GET form, even if documented like this :

@ApiImplicitParams({	//FIXME
	@ApiImplicitParam(name = "page", dataType = "integer", paramType = "query",
					  value = "Results page you want to retrieve (0..N)"),
	@ApiImplicitParam(name = "size", dataType = "integer", paramType = "query",
					  value = "Number of records per page."),
	@ApiImplicitParam(name = "sort", allowMultiple = true, dataType = "string", paramType = "query",
					  value = "Sorting criteria in the format: property(,asc|desc). "
							  + "Default sort order is ascending. "
							  + "Multiple sort criteria are supported.")
})
Page<Person> findByAddressCity(@Param("city") String city, Pageable p);

tooms4444 avatar Nov 30 '16 14:11 tooms4444

The solution you can use is to create PageableParameterPlugin extends springfox.documentation.spi.service.ParameterPlugin in which you'll have to override the apply method in which you define how to document the Pageable object. JHipster provides a very clean implementation you can find here

abderraza8k avatar Dec 07 '16 13:12 abderraza8k

Love to see this default, include in springfox-data-rest?

saturnism avatar Dec 10 '16 01:12 saturnism

@saturnism would you be able to help out with a PR?

dilipkrish avatar Dec 14 '16 03:12 dilipkrish

Closing this as a duplicate for #755

dilipkrish avatar Feb 15 '17 03:02 dilipkrish