-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
(Describe the problem clearly and concisely.)
When the JSON content is wrapped in a 'Multi', it is not recognised as a Quarkus web resource, instead it embeds the entire json object in a new object called 'map'.
Here is the code:
@Path("/users/v1")
@Produces(MediaType.APPLICATION_JSON)
public class UserResource {
@GET
@Path("{name}/multi")
@Produces(MediaType.APPLICATION_JSON)
public Multi<JsonObject> multi(@PathParam String name) {
Multi<JsonObject> multi = Multi.createFrom().items(new JsonObject().put("Hello", name));
return multi;
}
@GET
@Path("{name}/uni")
@Produces(MediaType.APPLICATION_JSON)
public Uni<JsonObject> uni(@PathParam String name) {
Uni<JsonObject> multi = Uni.createFrom().item(new JsonObject().put("Hello", name));
return multi;
}
}
when I access this end point:
localhost:82/users/v1/all/uni
I
it returns a nicely formated json like this:
{
"Hello": "all"
}
however, when i access localhost:82/users/v1/all/multi
[
{
"empty": false,
"map": {
"Hello": "all"
}
}
]
Expected behavior
(Describe the expected behavior clearly and concisely.)
It is expected to return this :
{
"Hello": "all"
}
Actual behavior
(Describe the actual behavior clearly and concisely.)
It returns this:
[
{
"empty": false,
"map": {
"Hello": "all"
}
}
]
To Reproduce
Steps to reproduce the behavior:
- Create a JAX-RS resource method that returns a Multi
- Annotate the method with @produces(MediaType.APPLICATION_JSON) on the methos
- Add Multi multi = Multi.createFrom().items(new JsonObject().put("Hello", name));
return multi; to the bosy of the method
Configuration
# Add your application.properties here, if applicable.
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
- Output of
uname -aorver: - Output of
java -version: - GraalVM version (if different from Java):
- Quarkus version or git rev:
- Build tool (ie. output of
mvnw --versionorgradlew --version):
Additional context
(Add any other context about the problem here.)