This works:
//Example 1
@Headers("Content-Type: application/json")
@RequestLine("POST api/v2/clients")
ClientResponse findAllClientsByUid1(@RequestBody ClientRequest request);
But this doesn't work:
//Example 2
@Headers("Content-Type: application/json")
@RequestLine("GET api/v2/clients/{uid}")
ClientResponse findAllClientsByUid2(@PathVariable(value = "uid") String uid,
@RequestParam(value = "limit", required = false) Integer limit,
@RequestParam(value = "offset", required = false) Integer offset);
}
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.services.requestresponse.ClientResponse com.microservice.gateway.feign.ClientFeignV2.findAllClientsByUid2(java.lang.String,java.lang.Integer,java.lang.Integer)
Based on the exception, it's failing because the HTTP.GET method doesn't allow response objects to have too many fields & nested fields. Surprisingly using the same returned Response Objects for the HTTP.POST, it works well. But According to REST-API standards, I can't do a POST when I want to read a resource.
This is a consequence of mixing feign and jaxrs annotations.
Either use feign contract or jaxrs contract.
Made a PR to add more information when this happens
Thank you.
The issue was: Mixing dependencies from OpenFeign & "Spring Cloud OpenFeign".
Most helpful comment
This is a consequence of mixing feign and jaxrs annotations.
Either use feign contract or jaxrs contract.