-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Enhance swagger-ui access #1384
Comments
You are using the wrong url to request the swagger-ui. Use the default url as described in the documentation: http://serverName:applicationPort/swagger-ui.html |
It is still a strange default behaviour - as if loading of the default configuration has to be "triggered" by /swagger-ui.html. To recap:
This behaviour seems independent of the queryConfigEnabled configuration. A pretty common behaviour is to bookmark the page appearing in the browser after being sent the link - this will make /swagger-ui/index.html bookmarked, which will fail after new deploys until someone "triggers" config loading by navigating to /swagger-ui.html. Is this really the intended behaviour? (BTW, thanks for your commitment and fast responses) |
You shouldn't navigate to Now since You should only use: Simply bookmark Hope it answers your question. |
Yes, I understand that I should use
The This is not a big issue, and I will not push further, but I still think that it violates the principle of least surprise. Thanks again for taking the time listening to your users. |
We have chosen not to change the default swagger-ui settings for security reasons, The last thing, is if you believe there is a better url handling, feel free to propose a PR. |
Yes, I agree 100% with the decision to not set queryConfigEnabled enabled by default - I'm sorry if anything I said made it appear otherwise. Following a link provided as a query parameter in the URL without validation never seems like a good idea from a security perspective, even if it happens client-side. I will take a look at the source - a spontaneous thought is if one somehow could initialize whatever lazy property that holds the configUrl at application startup instead of when the user navigates to |
I thought that a workaround could be to manually configure the configUrl to the generated one: Problem is, that when this property is configured, the contents on that URL will not be properly generated. I got it to work by rearranging the if-clauses in AbstractSwaggerWelcome#buildConfigUrl like so:
but maybe this could be done in the Feel free to reach out if you feel this is a path worth making a PR for or if I could help in any other way, |
@bnasslahsen I tried the 1.6.2-SNAPSHOT. Unfortunately it seems to break the grouping functionality, regardless of if I use I'll take a further look, just wanted to let you know. |
Yes, I will try to provide an example - unfortunately I will be away for a week, so it will appear after Christmas if not solved before that. What I can say immediately, is the following:
I have tried to quickly compare with the demo application which uses a mix between application.yaml-group-configs and The difference appears when switching from 1.6.1 or earlier, to 1.6.2-SNAPSHOT. |
I think it's finally with the webflux demo only in local demo! |
Feel free to test with latest version and provide your feedback. |
@bnasslahsen Thanks for your help! |
Perfect! And thank you for your help on this enhancement. |
@abrudin @bnasslahsen |
Describe the bug
${apiDocs.path}/swagger-config
To Reproduce
Steps to reproduce the behavior:
Start the Spring Boot application
Open
swagger-ui/index.html?configUrl=/api-docs/v3/swagger-config
Swagger UI cannot find the API definition. The source of index.html contains:
Open
/api-docs/v3/swagger-config
Open
swagger-ui/index.html?configUrl=/api-docs/v3/swagger-config
againSwagger UI can now find the API definition. The source of index.html contains:
Expected behavior
Swagger UI should always work
The text was updated successfully, but these errors were encountered: