quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Enhancement : Improve documentation about using RestResponse vs Response (and parts related to reflection)

Open omasseau opened this issue 6 months ago • 3 comments

Description

Hello ;),

I noticed the documentation is a bit confusing about the usage of RestResponse and Response and sometimes contradicts itself.

Here is an exemple with these two pages :

https://quarkus.io/guides/rest#manually-setting-the-response This one tells this :

If you need to set more properties on the HTTP response than just the body, such as the status code or headers, you can make your method return org.jboss.resteasy.reactive.RestResponse from a resource method. ... You can also use the Jakarta REST type Response but it is not strongly typed to your entity.

https://quarkus.io/guides/rest-json#using-response This one tells this :

Another common pattern in the Jakarta REST world is to use the Response object ... It is not possible for Quarkus to determine at build time the type included in the Response as the information is not available. In this case, Quarkus won’t be able to automatically register for reflection the required classes. ... We can register Legume for reflection manually by adding the @RegisterForReflection annotation on our Legume class:

It does not even talk about RestReponse and lets the reader thinks that the only solution for the class to be registered for reflection is to use the @RegisterForReflection. But this is not needed if using RestResponse<Legume> right ? In this case the Legume class is automatically registered for reflection.

Shouldn't only RestReponse be used in the documentation as it is best to use RestEasy Reactive API than RestEasy API ? :)

Implementation ideas

No response

omasseau avatar Aug 13 '24 17:08 omasseau