Skip to content
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

ParamConverter for query params not used in RestEasy Reactive #23486

Closed
pravussum opened this issue Feb 7, 2022 · 1 comment · Fixed by #23503
Closed

ParamConverter for query params not used in RestEasy Reactive #23486

pravussum opened this issue Feb 7, 2022 · 1 comment · Fixed by #23503
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@pravussum
Copy link
Contributor

Describe the bug

I have a Quarkus project using Resteasy reactive + Jackson with a generated REST API interface. That includes query parameters of type Map<String, Object> which are sent as JSON by the client.

The Quarkus build fails with the following exception:

java.lang.RuntimeException: Invalid parameter type 'java.util.Map<java.lang.String, java.lang.Object>' used on method method io.smallrye.mutiny.Uni<org.acme.Pojo> testEndpoint(java.util.Map<java.lang.String, java.lang.Object> projection) on class org.acme.MyApi

According to the JAX-RS resources documentation a valid method parameter has to fulfill one of the following:

In general the Java type of the method parameter may:

Be a primitive type;

Have a constructor that accepts a single String argument;

Have a static method named valueOf or fromString that accepts a single String argument (see, for example, Integer.valueOf(String) and java.util.UUID.fromString(String));

Have a registered implementation of jakarta.ws.rs.ext.ParamConverterProvider JAX-RS extension SPI that returns a jakarta.ws.rs.ext.ParamConverter instance capable of a "from string" conversion for the type. or

Be List<T>, Set<T> or SortedSet<T>, where T satisfies 2 or 3 above. The resulting collection is read-only. 

This is the case, as I provide a ParamConverter + ParamConverterProvider.

Hint: It seems the corresponding class is only able to parse a handful of parameterized types (like list and (sorted) set), but not maps or other types, it does not even look up existing ParamConverters.

I created a reproducer which fails when being built: https://github.com/pravussum/quarkus-query-param-repro

Interestingly, the non-reactive version of RestEasy is able to handle this properly - there is another branch in the reproducer project called non-reactive, which builds fine.

Expected behavior

In the reproducer at https://github.com/pravussum/quarkus-query-param-repro there is a branch called non-reactive, which works.
The reactive version (main branch) should behave the same.

Actual behavior

The build of the reactive version (main branch) fails with the above error.

How to Reproduce?

Here is a reproducer: https://github.com/pravussum/quarkus-query-param-repro

Just clone & run mvn install to see the build fail.

Output of uname -a or ver

5.13.0-27-generic #29-Ubuntu SMP Wed Jan 12 17:36:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk-15.0.2

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.0

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.8.4

Additional information

No response

@pravussum pravussum added the kind/bug Something isn't working label Feb 7, 2022
@pravussum pravussum changed the title [RestEays Reactive] ParamConverter for query params not used [RestEasy Reactive] ParamConverter for query params not used Feb 7, 2022
@geoand geoand changed the title [RestEasy Reactive] ParamConverter for query params not used ParamConverter for query params not used in RestEasy Reactive Feb 8, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 8, 2022

/cc @FroMage, @stuartwdouglas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants