-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
area/jacksonIssues related to Jackson (JSON library)Issues related to Jackson (JSON library)area/restkind/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
After playing around with a potential solution, I ended up filing this feature request. I have class called Role
, that works in the following Scenarios:
- Accept, deserialize, serialize, and return
Uni<Role>
with@Consumes({MediaType.APPLICATION_JSON})
and@Produces({MediaType.APPLICATION_JSON})
. - Media types
application/x+yaml
works when consuming and returningString
andUni<String>
respectively, then I handle serde on my own.
The method signature looks like this:
@Post
@Consumes(...)
@Produces(...)
public Uni<Role> handle(Role role) {
// do all the things
return Uni.createFrom().item(role);
}
Works like a charm for application/json
. Throws an error for application/x+yaml
.
I've added the following dependency and configured quarkus accordingly:
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-yaml-provider</artifactId>
</dependency>
quarkus:
index-dependency:
yaml:
group-id: 'com.fasterxml.jackson.jaxrs'
artifact-id: jackson-jaxrs-yaml-provider
Don't know if this is the appropriate channel. I also don't see any mention in the Resteasy Reactive Documentation https://quarkus.io/guides/resteasy-reactive. I attach a sample stacktrace when having the following method signature:
@Post
@Consumes({"application/x+yaml"})
@Produces({"application/x+yaml"})
public Uni<Role> handle(Role role) {
// do all the things
return Uni.createFrom().item(role);
}
Stacktrace
2023-03-13 16:45:04,308 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (vert.x-eventloop-thread-4) Request failed: java.lang.IllegalArgumentException: Class `org.acme.Role` not subtype of `io.smallrye.mutiny.Uni<org.acme.Role>`
at com.fasterxml.jackson.databind.type.TypeFactory.constructSpecializedType(TypeFactory.java:464)
at com.fasterxml.jackson.databind.type.TypeFactory.constructSpecializedType(TypeFactory.java:426)
at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:593)
at org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:233)
at org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:191)
at org.jboss.resteasy.reactive.server.core.serialization.FixedEntityWriterArray.write(FixedEntityWriterArray.java:30)
at org.jboss.resteasy.reactive.server.handlers.ResponseWriterHandler.handle(ResponseWriterHandler.java:34)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:120)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at org.jboss.resteasy.reactive.server.vertx.VertxResteasyReactiveRequestContext$1$1.handle(VertxResteasyReactiveRequestContext.java:78)
at org.jboss.resteasy.reactive.server.vertx.VertxResteasyReactiveRequestContext$1$1.handle(VertxResteasyReactiveRequestContext.java:75)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246)
at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:43)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:566)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
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:833)
Implementation ideas
No response
Metadata
Metadata
Assignees
Labels
area/jacksonIssues related to Jackson (JSON library)Issues related to Jackson (JSON library)area/restkind/bugSomething isn't workingSomething isn't working