The Quarkus Rest client does not seem to support @QueryParam arguments which are of type java.util.Optional or io.vavr.control.Option.
Using an argument like @QueryParam("type") Optional<String> or @QueryParam("type") Option<String> creates a url like http://myhost/endpoint?type=Optional%5Btype%5D or http://myhost/endpoint?type=Some%28type%29.
Or with ?type=Optional.empty or ?type=None when no value is provided.
Currently the only option to have optional query parameters seems to be to use a @RestQuery Map<String, String> queryParams argument.
This however do not give a strict control on which query parameters are allowed.
It would therefore be nice to support Optional and/or Option argument to have a better typed and documented Rest client function.
Implementation ideas
Support java.util.Optional as @QueryParam arguments.
When a value is provided, add it to the query parameters.
When no value is provided, do not add it to the query parameters.
And it would be awesome when also Vavr's io.vavr.control.Option could be supported.
Description
The Quarkus Rest client does not seem to support
@QueryParam
arguments which are of typejava.util.Optional
orio.vavr.control.Option
.Using an argument like
@QueryParam("type") Optional<String>
or@QueryParam("type") Option<String>
creates a url likehttp://myhost/endpoint?type=Optional%5Btype%5D
orhttp://myhost/endpoint?type=Some%28type%29
. Or with?type=Optional.empty
or?type=None
when no value is provided.Currently the only option to have optional query parameters seems to be to use a
@RestQuery Map<String, String> queryParams
argument. This however do not give a strict control on which query parameters are allowed.It would therefore be nice to support
Optional
and/orOption
argument to have a better typed and documented Rest client function.Implementation ideas
Support
java.util.Optional
as@QueryParam
arguments. When a value is provided, add it to the query parameters. When no value is provided, do not add it to the query parameters.And it would be awesome when also Vavr's
io.vavr.control.Option
could be supported.