Add CollectionFormat support (#371)

* Add CollectionFormat support. Fixes gh-146.

* Minor refactoring.

* Fix docs.
This commit is contained in:
Olga Maciaszek-Sharma
2020-07-17 08:05:21 -05:00
committed by GitHub
parent 4e89dd1523
commit d3da7e16e8
5 changed files with 227 additions and 55 deletions

View File

@@ -586,6 +586,25 @@ public interface DemoTemplate {
}
----
=== Feign `CollectionFormat` support
We support `feign.CollectionFormat` by providing the `@CollectionFormat` annotation. You can annotate a Feign client method with it by passing the desired `feign.CollectionFormat` as annotation value.
In the following example, the `CSV` format is used instead of the default `EXPLODED` to process the method.
[source,java,indent=0]
----
@FeignClient(name = "demo")
protected interface PageableFeignClient {
@CollectionFormat(feign.CollectionFormat.CSV)
@GetMapping(path = "/page")
ResponseEntity performRequest(Pageable page);
}
----
TIP: Set the `CSV` format while sending `Pageable` as a query parameter in order for it to be encoded correctly.
=== Reactive Support
As the https://github.com/OpenFeign/feign[OpenFeign project] does not currently support reactive clients, such as https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/reactive/function/client/WebClient.html[Spring WebClient], neither does Spring Cloud OpenFeign. We will add support for it here as soon as it becomes available in the core project.