-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add "root-path" to swagger-ui #44981
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
Open
alexey-plotnikoff
wants to merge
28
commits into
quarkusio:main
Choose a base branch
from
alexey-plotnikoff:swagger
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
09546c7
Add "location-path" to swagger-ui
840057e
Merge branch 'main' into swagger
067834f
Add "location-path" to swagger-ui
d043978
Merge branch 'main' into swagger
alexey-plotnikoff 8ebcae6
Code review fixes
c698015
Merge remote-tracking branch 'origin/swagger' into swagger
a6a817e
Merge branch 'main' into swagger
alexey-plotnikoff 4005c90
Merge branch 'main' into swagger
alexey-plotnikoff 2e3e4b5
Code review fixes
251bef9
Merge branch 'main' into swagger
alexey-plotnikoff 7317647
Code review fixes
c87627f
Merge remote-tracking branch 'origin/swagger' into swagger
89cc368
fix import sort
4081018
Merge branch 'main' into swagger
alexey-plotnikoff 43af23e
Merge branch 'main' into swagger
alexey-plotnikoff 44970a3
Add "location-path" to swagger-ui
b7c8825
Add "location-path" to swagger-ui
bc6018d
Code review fixes
0d7353b
Code review fixes
c3e7ab7
fix import sort
b4b0af7
Merge remote-tracking branch 'origin/swagger' into swagger
9a1b1b1
rebase
6c75549
Merge branch 'main' into swagger
alexey-plotnikoff 083be9b
fix import
0ff0029
Merge branch 'main' into swagger
alexey-plotnikoff 614984c
Merge branch 'main' into swagger
alexey-plotnikoff ddc6831
Merge branch 'main' into swagger
alexey-plotnikoff 5ef855b
Merge branch 'main' into swagger
alexey-plotnikoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ons/swagger-ui/deployment/src/test/java/io/quarkus/swaggerui/deployment/RootPathTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package io.quarkus.swaggerui.deployment; | ||
|
|
||
| import static org.hamcrest.Matchers.containsString; | ||
|
|
||
| import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
|
||
| import io.quarkus.test.QuarkusUnitTest; | ||
| import io.restassured.RestAssured; | ||
|
|
||
| public class RootPathTest { | ||
|
|
||
| @RegisterExtension | ||
| static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
| .withApplicationRoot((jar) -> jar | ||
| .addAsResource(new StringAsset( | ||
| "quarkus.swagger-ui.root-path=/nginx/path"), "application.properties")); | ||
|
|
||
| @Test | ||
| public void shouldUseCustomRootPath() { | ||
| RestAssured.when().get("/q/swagger-ui").then().statusCode(200).body(containsString("/nginx/path/q/openapi")); | ||
| RestAssured.when().get("/q/swagger-ui/index.html").then().statusCode(200).body(containsString("/nginx/path/q/openapi")); | ||
| RestAssured.when().get("/q/swagger-ui").then() | ||
| .statusCode(200) | ||
| .body(containsString("/nginx/path/q/swagger-ui/oauth2-redirect.html")); | ||
| RestAssured.when().get("/q/swagger-ui/index.html").then() | ||
| .statusCode(200) | ||
| .body(containsString("/nginx/path/q/swagger-ui/oauth2-redirect.html")); | ||
| RestAssured.when().get("/q/swagger-ui").then() | ||
| .statusCode(200) | ||
| .body(containsString("/nginx/path/q/swagger-ui")); | ||
| RestAssured.when().get("/q/swagger-ui/index.html").then() | ||
| .statusCode(200) | ||
| .body(containsString("/nginx/path/q/swagger-ui")); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My problem with how it's implemented is that the value is fixed at build time.
Will it fly in standard setups? (Honest question, I don't have an answer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question.
@phillip-kruger what do you think?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @gsmet but we have same problem for all variables in
indexHtmlContent:openApiPath = nonApplicationRootPathBuildItem.resolvePath(openapi.path());Maybe we should fix this in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point swagger ui html is generated at build time. allowing dynamic creation at runtime will be a big change. We can maybe change the static generated html and js to allow some parameters that can change behavior at runtime, but even that is a much bigger change