quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Quarkus SwaggerUI ignores http.root.path if quarkus.resteasy-reactive.path is set

Open Fernichter opened this issue 3 years ago • 3 comments
trafficstars

Describe the bug

Im using the following config:

quarkus.http.root-path=/test-service
quarkus.http.port=${PORT:8080}
quarkus.resteasy-reactive.path=rest

SwaggerUI converts this to the following URL in the "try-out" feature:

curl -X 'GET' \
  'http://localhost:8080/rest/test' \
  -H 'accept: application/json'

SwaggerUI seems to ignore the http.root.path set in the config.

When im using the @ApplicationPath("/rest") annotation instead of quarkus.resteasy-reactive.path, everything works just fine. Is this intended or am I missing something?

Thanks

Expected behavior

SwaggerUI should provide the following request-url:

curl -X 'GET' \
  'http://localhost:8080/test-service/rest/test' \
  -H 'accept: application/json'

Actual behavior

SwaggerUI provides the following request-url:

curl -X 'GET' \
  'http://localhost:8080/rest/test' \
  -H 'accept: application/json'

How to Reproduce?

Use the following config:

quarkus.http.root-path=/test-service quarkus.http.port=${PORT:8080} quarkus.resteasy-reactive.path=rest

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

Quarkus 2.10.2.Final

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

No response

Additional information

No response

Fernichter avatar Jul 21 '22 19:07 Fernichter

/cc @FroMage, @MikeEdgar, @geoand, @phillip-kruger, @stuartwdouglas

quarkus-bot[bot] avatar Jul 21 '22 19:07 quarkus-bot[bot]

Can anyone reproduce this bug?

Fernichter avatar Aug 08 '22 19:08 Fernichter

I have not looked at this yet. If you create a small reproducer that makes it easier

phillip-kruger avatar Aug 08 '22 21:08 phillip-kruger

Hi,

I also have this problem with the same findings. I defined my root path like this: quarkus.http.root-path=/myApp

And I have an application that works well with the old version of RESTEasy with quarkus.resteasy.path=/api Swagger requesting: http://localhost:8080/myApp/api/resource ✔️

But now I have this problem with Swagger on my new application which uses quarkus.resteasy-reactive.path=/api Swagger requesting: http://localhost:8080/ ~~myApp~~ /api/resource ❌ (http://localhost:8080/api/resource)

Swagger makes requests without considering quarkus.http.root-path when quarkus.resteasy-reactive.path is also defined at the same time. I worked around this problem temporarily by deleting resteasy-reactive.path.

yacine-1 avatar Mar 07 '23 19:03 yacine-1

@MikeEdgar ^^^

phillip-kruger avatar Mar 08 '23 01:03 phillip-kruger

The issue is that for RESTEasy Classic the smallrye-openapi extension uses the RESTEasy extension's path that already includes the http.root-path, whereas for reactive it's using the raw configuration property. I'll put together a PR to address this.

https://github.com/quarkusio/quarkus/blob/d21383094cdc29d3d7370d6eb40fef923f2663be/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java#L869-L883

MikeEdgar avatar Mar 08 '23 12:03 MikeEdgar