quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.64k stars 2.64k forks source link

Quarkus REST should check for `@CustomSerialization` annotations on resource methods returning `Multi` #40447

Open michalvavrik opened 5 months ago

michalvavrik commented 5 months ago

Describe the bug

I mentioned that custom serialization for Multi doesn't work because serialization flow goes roughly like this:

Which effectively means that custom serialization is ignored because that one would require non-default writer as when io.quarkus.resteasy.reactive.jackson.runtime.serialisers.FullyFeaturedServerJacksonMessageBodyWriter#writeResponse is called.

Expected behavior

I didn't find documented that this shouldn't work for the Multi reactive type, therefore I would expect it to work.

Actual behavior

Custom serialization is not applied.

How to Reproduce?

I have tests for this: https://github.com/quarkusio/quarkus/commit/d3212670cb47ba431648378ecc4bf7f9b12e3785 just uncomment io.quarkus.resteasy.reactive.jackson.deployment.test.ResponseType#MULTI and run mvn clean test -f extensions/resteasy-reactive/rest-jackson/deployment/ -Dtest=SecureFieldDetectionTest

Output of uname -a or ver

Fedora 38

Output of java -version

OpenJDK 21

Quarkus version or git rev

999-SNAPSHOT

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

Apache Maven 3.9.4

Additional information

No response

geoand commented 4 months ago

Yeah, ideally we would make it work