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

Custom mimetype causes quarkus-rest-client-reactive being unable to deserialize #21957

Closed
floriansiepe opened this issue Dec 6, 2021 · 4 comments · Fixed by #22021
Closed
Assignees
Labels
area/rest-client kind/bug Something isn't working
Milestone

Comments

@floriansiepe
Copy link

Describe the bug

Reactive rest client does not deserialize custom, "json-like" mimetypes (e.g. application/*+json) are not deserialized correctly.

Expected behavior

All mimetypes matching the pattern application/*+json should be deserialized using Jackson

Actual behavior

Rest client throws the following error:

javax.ws.rs.ProcessingException: Response could not be mapped to type java.util.Map<java.lang.String,java.lang.Object>
	at org.jboss.resteasy.reactive.client.impl.ClientReaderInterceptorContextImpl.proceed(ClientReaderInterceptorContextImpl.java:62)
	at org.jboss.resteasy.reactive.client.impl.ClientSerialisers.invokeClientReader(ClientSerialisers.java:141)
	at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext.readEntity(RestClientRequestContext.java:157)
	at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.mapToResponse(ClientResponseCompleteRestHandler.java:30)
	at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.handle(ClientResponseCompleteRestHandler.java:16)
	at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.handle(ClientResponseCompleteRestHandler.java:12)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
	at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext$1.lambda$execute$0(RestClientRequestContext.java:251)
	at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100)
	at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63)
	at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:829)

How to Reproduce?

Small reproducer:
test.zip

Execute:
curl http://localhost:8080/hello

Output of uname -a or ver

Linux elitebook 5.15.6-200.fc35.x86_64 #1 SMP Wed Dec 1 13:41:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.13" 2021-10-19 OpenJDK Runtime Environment 18.9 (build 11.0.13+8) OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.5.2.Final

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

No response

Additional information

No response

@floriansiepe floriansiepe added the kind/bug Something isn't working label Dec 6, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 6, 2021

/cc @michalszynkiewicz

@geoand
Copy link
Contributor

geoand commented Dec 8, 2021

Does the same thing work with the old rest client?

The basic question I guess is, why do you expect it to work?

@floriansiepe
Copy link
Author

Hi @geoand.
In another serivce, where I used the old rest client it works with the same content type.

I saw, that it is quite common with custom mimetypes to match the pattern applicaton/*+json if the responses can be serialized as a proper json.
E.g. API versioning is a use-case for this. One might have two endpoints under the same path with the same HTTP method but a different content-type which serve two different API versions. For example one with application/vnd.search.v1+json and the second with application/vnd.search.v2+json.

@geoand
Copy link
Contributor

geoand commented Dec 8, 2021

#22021 should take care of it

@geoand geoand self-assigned this Dec 8, 2021
michalszynkiewicz added a commit that referenced this issue Dec 8, 2021
Support media type suffixes in reactive rest client
@quarkus-bot quarkus-bot bot added this to the 2.7 - main milestone Dec 8, 2021
@gsmet gsmet modified the milestones: 2.7 - main, 2.5.2.Final Dec 9, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 9, 2021
Postremus pushed a commit to Postremus/quarkus that referenced this issue Dec 10, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants