Skip to content
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

Add Swagger UI Options via config #12782

Merged
merged 1 commit into from Oct 20, 2020
Merged

Add Swagger UI Options via config #12782

merged 1 commit into from Oct 20, 2020

Conversation

phillip-kruger
Copy link
Member

@phillip-kruger phillip-kruger commented Oct 19, 2020

This PR adds all the options from Swagger UI as config options. (see https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/)

It supersede #6314.
Close #6314
Fix #5639
Fix #4766

from #5639

(f.y.i - @misaunde and @valones)

quarkus.swagger-ui.doc-expansion=full
quarkus.swagger-ui.display-request-duration=true

from #6314

(f.y.i - @yntelectual @Postremus @aoudiamoncef)

You can add multiple urls now:

quarkus.swagger-ui.urls.default=/openapi
quarkus.swagger-ui.urls.petstore=https://petstore.swagger.io/v2/swagger.json

This will create the dropdown in the header:

Screenshot_urls

from #4766

(f.y.i - @btsibr @Agh42)

quarkus.swagger-ui.oauth2-redirect-url=/somesecure/page/oauth.html
quarkus.swagger-ui.validator-url=localhost

Other

Theme
You can now select any theme from https://github.com/ostranme/swagger-ui-themes, example:

quarkus.swagger-ui.theme=monokai

Screenshot_theme

Footer
You can add a footer:

quarkus.swagger-ui.footer=© 2020 . Phillip Kruger

Screenshot_footer

Title
You can set the HTML title

quarkus.swagger-ui.title=OpenAPI for Everyone

Default title will be: OpenAPI UI (Powered by Quarkus version-number-here)

All other options from swagger ui available via config.

In dev mode, the options will take effect immediately.

Signed-off-by:Phillip Kruger phillip.kruger@gmail.com

gsmet
gsmet previously requested changes Oct 19, 2020
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is VERY nice. I wanted that for so long.

I added several totally uninteresting comments related to doc (sorry!) :).

Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
@phillip-kruger
Copy link
Member Author

@gastaldi @gsmet - Thanks for the review. All issues fixed as requested. Please let me know if there is anything else.

@gastaldi
Copy link
Contributor

Outstanding job @phillip-kruger ! Nice!

@gastaldi gastaldi added this to the 1.10 - master milestone Oct 19, 2020
@gastaldi gastaldi added release/noteworthy-feature triage/waiting-for-ci Ready to merge when CI successfully finishes labels Oct 19, 2020
@gastaldi gastaldi dismissed gsmet’s stale review October 19, 2020 20:47

Changes addressed

@gsmet gsmet merged commit 9570694 into quarkusio:master Oct 20, 2020
@gsmet
Copy link
Member

gsmet commented Oct 20, 2020

Glad we finally have this one in! Thanks!

@phillip-kruger phillip-kruger deleted the swagger-ui-options branch October 20, 2020 09:11
@matus-m
Copy link

matus-m commented Oct 26, 2020

hi any chance this will make it into 1.9.x? Or do we need to wait for 1.10? Thanks

@gastaldi
Copy link
Contributor

This is planned for 1.10. According to https://github.com/quarkusio/quarkus/wiki/Release-Planning, the first CR should be available on Nov 10th.

@enbohm
Copy link

enbohm commented Nov 26, 2020

Great feature really like it! One question though, is it possible to change the logo at the top of Swagger UI? Currently it is the 'Quarkus' logo displayed but I can't find a way to have a custom one. Thanks,

@phillip-kruger
Copy link
Member Author

@enbohm
Copy link

enbohm commented Nov 26, 2020

@phillip-kruger awesome big thx! :)

@enbohm
Copy link

enbohm commented Nov 27, 2020

@phillip-kruger I got the logo customization working after a while (worked when Quarkus was running in dev-mode but not using an executable jar or native). I noticed that I needed to specify the prepare-goal in the execution-section of the quarkus-maven-plugin (I only had the build-goal earlier). Might be good to add this info an upcoming guide since a bit tricky to figure out :)

Otherwise it works like a charm now, great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/noteworthy-feature triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[openapi] Add Ability to Configure Swagger UI swagger-ui is not mapping oauth2-redirect.html
5 participants