as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client
I have some problems sending a Pageable object in a POST request containing a @requestbody element.
First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core.
Example:
@PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto example, Pageable pageable)
{ "example": { "message": "string" }, "pageable": { "pageNumber": 0, "pageSize": 50, "offset": 10, "sort": { "sorted": false, }, "paged": true, } }
No I learned, that I can send it via Query parameter aswell and it will be parsed. The annotation that extracts the pageable into QueryParams is called org.springdoc.api.annotations.ParameterObject in SpringDoc.
@PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto example, @ParameterObject Pageable pageable) { return helloCallerService.callHelloServiceClient(example, pageable); }
When I try to call a similar controller interface via feign like this client interface:
@PostMapping("/search") public Page<HelloDto> searchHellos(@RequestHeader("apiKey") String apiKey, @RequestBody HelloDto example, Pageable pageable);
The application won't start since the method "has too many body params". I tried to annotate Pageable with @RequestParam but it won't be recognized / parsed.
My question is:
Can we use a custom AnnotatedParameterProcessor for e.g. @ParameterObject that flats out the ParameterObject and encodes it into the url query parameters?
How would you do that? Or is the AnnotatedParameterProcessor the wrong way? Do I maybe need an expander or anything?