feign icon indicating copy to clipboard operation
feign copied to clipboard

Sort query parameter is getting splitted

Open maxqfz opened this issue 6 years ago • 3 comments

Hello! In my project I use Pageable for correct paging and sorting of response results:

@GetMapping(value = "/endpoint-with-pagination-support")
fun getPage(pageable: Pageable): Page<SomeDTO>

After updating to the latest version I noticed it stopped working correctly. Sort direction (ASC,DESC) isn't preserved anymore. I debugged feign requests and noticed some query param expansion process, which was added in version 10.7.2 in this commit https://github.com/OpenFeign/feign/commit/a7b7c01806324126dd844a9a912e309754bc4dc9#diff-52499e1757ad7b3aeb1163f476846de3R190 I assume sort query parameter should be sort=name,DESC as it was before, but now it is sort=name&sort=DESC, so Spring looses the second part with direction.

maxqfz avatar Jun 24 '20 15:06 maxqfz

This is due to our internal logic that separates query parameters using a , comma. This will be addressed in #1019.

Pageable has been troublesome for some time now. One way to manage this today is to use a Custom Expander to manage object.

kdavisk6 avatar Jul 02 '20 14:07 kdavisk6

Try my way ! @SpringQueryMap Pageable page

pstree avatar Nov 09 '20 02:11 pstree

@maxqfz This has been fixed. In 10.12 the result of this is sort=name%2CDESC, which is an appropriate result given the comma should be encoded on the query string.

kdavisk6 avatar Dec 29 '20 17:12 kdavisk6