-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting quarkus.resteasy.path not reflected in OpenAPI or Swagger #19434
Comments
Do you perhaps have a small reproducer ? |
We have these 2 test cases testing this scenario: |
I tried to build a small reproducer but I am not sure if it is valid or not. For whatever reason, it seems when I use "quarkus.resteasy.path" it does not get recognized but using "rest.path" does. I've now managed to confused myself. Either way, if this is valid, the SwaggerUI does not reflect the path set in the application.yaml. I will look into it a little more later today but maybe for starters this helps. |
Maybe a yaml issue ? Have you tried with application.properties ? (that is how the test cases work) |
Hmm, just tried with application.properties (just replaced the yaml with an application.properties) and it did the same thing. As a side note, using the @ApplicationPath "seemed" to work as expected - both OAS and Swagger reflected the path. |
Maybe look at the tests I have referenced, and see if you can configure a test so that it replicate your setup ? |
The "should_have_v1" test give me the error using either the yaml/properties file. The "should_not_have_v1" passes. [ERROR] Failures: @QuarkusTest
public class OpenApiTest {
private static final String OPEN_API_PATH = "/q/openapi";
@Test
public void should_have_v1_in_path() {
RestAssured.given().queryParam("format", "JSON").when().get(OPEN_API_PATH).then()
.header("Content-Type", "application/json;charset=UTF-8")
.body("openapi", Matchers.startsWith("3.0"))
.body("info.title", Matchers.equalTo("Generated API"))
.body("paths", Matchers.hasKey("/v1/ping/me"));
}
@Test
public void should_not_have_v1_in_path() {
RestAssured.given().queryParam("format", "JSON").when().get(OPEN_API_PATH).then()
.header("Content-Type", "application/json;charset=UTF-8")
.body("openapi", Matchers.startsWith("3.0"))
.body("info.title", Matchers.equalTo("Generated API"))
.body("paths", Matchers.hasKey("/ping/me"));
}
} |
Yes, should be This may also help: https://quarkus.io/blog/path-resolution-in-quarkus/ Note that as of 2.x, the redirect behavior has been removed, but the rest is accurate. |
quarkus.*rest*.path or quarkus.*resteasy*.path? I am totally confused
now. The test case I mirrored used *resteasy*.
From the test case...
@RegisterExtension
static QuarkusUnitTest runner = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(OpenApiResource.class, ResourceBean.class)
.addAsResource(new StringAsset(
"quarkus.resteasy.path=/foo/bar"),
"application.properties"));
Either way, both seemed, but i can retest, to give me the same results. In
fact, my reproducer has the "rest" property just commented out as well.
Just confirmed, using my reproducer with a mirrored test case (details on
#19434) using either "rest" or
"resteasy" gives me the same results. Using the @ApplicationPath seems to
work.
…On Tue, Aug 17, 2021 at 10:43 AM Erin Schnabel ***@***.***> wrote:
Yes, should be quarkus.rest.path
This may also help:
https://quarkus.io/blog/path-resolution-in-quarkus/
Note that as of 2.x, the redirect behavior has been removed, but the rest
is accurate.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19434 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAECKMXMAY4CSSBPZXCQ7D3T5JYQBANCNFSM5CIW3E5Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
@kjq thanks for the test cases, looking at this now. |
@ebullient - Are you sure about this ? The test case use Maybe you are thinking of @ebullient - After a quick look it seems like the Line 20 in 77d652e
|
@kjq ok @ebullient confirmed that the |
@kjq @ebullient I can confirm this is a bug. See attached your original reproducer, that is now working for normal requests (as you described) but the value in the openapi document is wrong. I'll prepare a PR to fix a.s.a.p. B.t.w - If you use resteasy reactive, you need to use |
When we worked on the path support, |
Ok cool ! Thanks for confirming :) |
The documentation https://quarkus.io/guides/resteasy-reactive only talks about this property "quarkus.rest.path" and does not define that it is deprecated. |
Can you open a new issue? |
Describe the bug
When I set the "quarkus.resteast.path" it works making API calls directly but does not get reflected in the OpenAPI or Swagger.
Using @ApplicationPath and setting eash @path looks to work.
Expected behavior
OpenAPI and Swagger reflect the path set in the application properties.
Actual behavior
RESTful calls works but OpenAPI and Swagger do not reflect the path. From Swagger invoking an endpoint gives a 404.
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: