-
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 work with a Map #43784
Labels
Milestone
Comments
/cc @cescoffier (rest-client), @geoand (rest-client) |
Attaching a patch to simplify the reproduction. |
geoand
added a commit
to geoand/quarkus
that referenced
this issue
Oct 14, 2024
geoand
added a commit
to geoand/quarkus
that referenced
this issue
Oct 14, 2024
geoand
added a commit
that referenced
this issue
Oct 14, 2024
Properly handle Map of form params in REST Client
Thanks for the fast fix! |
👌 |
gsmet
pushed a commit
to gsmet/quarkus
that referenced
this issue
Oct 21, 2024
Fixes: quarkusio#43784 (cherry picked from commit 95d4920)
9 tasks
bschuhmann
pushed a commit
to bschuhmann/quarkus
that referenced
this issue
Nov 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Using
@RestForm
with aMap<String,String>
fails with the following message:java.lang.IllegalStateException: Form element 'org.acme.rest.client.ExtensionsService.postFilter' could not be converted to 'String' for REST Client interface 'org.acme.rest.client.ExtensionsService'. A proper implementation of 'jakarta.ws.rs.ext.ParamConverter' needs to be returned by a 'jakarta.ws.rs.ext.ParamConverterProvider' that is registered with the client via the @RegisterProvider annotation on the REST Client interface.
Expected behavior
It should be possible to annotate a
Map<String, String>
(orMap<T,T>
withT
following the contract of theFormParam
javadoc) with@RestForm
.Note: I'm aware that
Map
itself doesn't follow the contract but according to the rest client quickstart, this should be supported.Actual behavior
When writing something like:
I observe:
How to Reproduce?
Checkout the rest client quickstart
Modify the https://github.com/quarkusio/quarkus-quickstarts/blob/main/rest-client-quickstart/src/main/java/org/acme/rest/client/ExtensionsResource.java class and add:
Start the application:
mvn quarkus:dev
Trigger the problematic code:
curl -X POST http://localhost:8080/extension/test
Output of
uname -a
orver
Darwin *** 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:39 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6000 arm64
Output of
java -version
openjdk version "21.0.4" 2024-07-16 LTS OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode)
Quarkus version or git rev
3.15.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /Users/***/.asdf/installs/maven/3.9.6 Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /Users/pierrebeitz/.asdf/installs/java/temurin-21.0.4+7.0.LTS Default locale: en_FR, platform encoding: UTF-8 OS name: "mac os x", version: "14.7", arch: "aarch64", family: "mac"
Additional information
No response
The text was updated successfully, but these errors were encountered: