-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REST Client @RestForm
does not convert for List<T>
#39996
Comments
/cc @cescoffier (rest-client), @geoand (rest-client) |
Support using List for sending multiple form values in REST Client
@geoand Hi Georgios, I tested this just now on 3.10.0.CR1 and while the fix works for I assume this is still a bug related to the above changes? Do you need anything from me to test for this? |
Yeah, definitely a bug, do you mind opening a new issue for it? Thanks |
I tried |
I still have the problem with @FormParam List with 3.15.1 : "could not be converted to 'String' for REST Client interface " This issue does not seem to be fixed |
Describe the bug
(Apologies for any incorrect terminology.) Normally when creating REST resources in quarkus, one can attach
@RestForm
or@FormParam
toList<T>
to indicate a repeated URL encoded form parameter, and this conversion will work as expected. For example:However, the same does not appear to work when describing a REST Client method in the same manner. Invoking the client method will throw an exception (see below.) Additionally,
@RestQuery
seems to work onList<T>
where@RestForm
/@FormParam
does not.Expected behavior
I would think that the annotations should behave the same between RESTEasy and REST Client. This page states that the two share the same infrastructure, which I would think includes parameter converters unless I'm misunderstanding something.
There's also this page that describes how to use
@RestForm
in REST Clients, but I'm not sure if this snippet of examples indicates "here are some, but not a complete set of, examples that can be done with@RestForm
" or if it means "these are the only types that@RestForm
supports in REST Clients"Actual behavior
Invoking the API throws an exception:
How to Reproduce?
Demo repo here:
https://github.com/krnhotwings/rest-client-test
podman run --rm -d -p 8001:8080 mendhak/http-https-echo:latest
quarkus dev
curl "http://localhost:8080/hello/post
Exception is throwncurl "http://localhost:8080/hello/get
Works.Exception is thrown here:
https://github.com/krnhotwings/rest-client-test/blob/main/src/main/java/org/acme/EchoClient.java#L19-L20
List<T>
works with@RestQuery
:https://github.com/krnhotwings/rest-client-test/blob/main/src/main/java/org/acme/EchoClient.java#L16-L17
Where the client is being invoked:
https://github.com/krnhotwings/rest-client-test/blob/main/src/main/java/org/acme/GreetingResource.java#L20-L28
Output of
uname -a
orver
Linux 6.8.4-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 4 20:45:21 UTC 2024 x86_64 GNU/Linux
Output of
java -version
openjdk version "21.0.2" 2024-01-16 OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30) OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)
Quarkus version or git rev
3.9.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.6 rev d55c486870a0dc6f6278f53d21381396d0741c6e
Additional information
No response
The text was updated successfully, but these errors were encountered: