Skip to content

openapi for RestResponse<Stream<T>> not automaticly documenting T #30248

@Postremus

Description

@Postremus

Describe the bug

The openapi for a resteasy-reactive resource like this is incorrect:

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public RestResponse<Stream<SomeObject>> hello() {
        return null;
    }

It documents the Stream class itself.

Expected behavior

I would expect the documentation to be generated as a List of SomeObject, i.e. the inner type of Stream.
This is also what the resource returns.

As workaround, I can annotate the method as follows, which produces the expected result:

@GET
    @Produces(MediaType.APPLICATION_JSON)
    @APIResponse(name = "200", content = @Content(schema = @Schema(type = SchemaType.ARRAY, implementation = SomeObject.class)))
    public RestResponse<Stream<SomeObject>> hello() {
        return null;
    }

Which correctly produces:
image

However, always having to add type and implementation (and not forgetting them / making copy & paste mistakes) becomes a bit cumbersome.

Can Stream please be automaticly detected?

Actual behavior

image

How to Reproduce?

Reproducer:
restresponse-openapi.zip

  1. mvn quarkus:dev
  2. Go to http://localhost:8080/q/swagger-ui
  3. Look at the responses of the /hello resource - looks correct since the workaround is active
  4. Now go to class GreetingResource and remove the APIResponse annotation
  5. Go to http://localhost:8080/q/swagger-ui
  6. Look at the responses of the /hello resource - looks wrong

Output of uname -a or ver

Microsoft Windows [Version 10.0.19044.2364]

Output of java -version

openjdk 17.0.4 2022-07-19 OpenJDK Runtime Environment Temurin-17.0.4+8 (build 17.0.4+8) OpenJDK 64-Bit Server VM Temurin-17.0.4+8 (build 17.0.4+8, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.15.2.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\eclipse\tools\java\maven Java version: 17.0.4, vendor: Eclipse Adoptium, runtime: C:\eclipse\tools\java\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions