-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Multiple Swagger UI's cannot co-exist #161
Comments
…r already exists
a) This is something I'd like to add to Javalin 6.x as I've already seen such issues with OpenApiPlugin in the past Btw, I'm just curious, why would you need to serve 2 Swagger UIs? 🤔 |
In our application we want to separate the internal and client-side openapi specs since third-party clients do not have to know about most of the internal calls. Yet, having openapi specs internally saves a lot of dev-time 😉 |
Ok, because I was wondering if versioned scheme with switch option in Swagger UI is not enough, but it sounds reasonable as well. |
If you were to serve 2 Swagger UIs, how would you note which one a route is supposed to be documented in when adding the This is also something that I'm looking to do - expose a public OpenApi endpoint with UIs for external clients and a separate internal set that requires auth to get to. |
We did so by excluding the routes in the swagger-ui they shouldn't appear. Since one of the two openapi definitions is a subset of the other one, it was fairly trivial to do the exclusion. Since I'm on mobile, I cannot easily point you towards the relevant code, but your starting point could be our repo |
* Resolved #161 by checking first if a webjarhandler is registered * Addressed PR comment and expanded unit test * GH-166 Code review --------- Co-authored-by: dzikoysk <[email protected]>
I'll keep this open, because we don't have built-in tools to support 2 standalone Swagger UIs. I'll keep this for Javalin 6.x as it'd require some breaking changes in current configs. |
There is currently two issues with multiple swagger UIs:
a) one has to create a sub-class of the plugin as otherwise
javalin
wouldn't register it (I will read upon that and mention it over atjavalin
. I guess there are plugins for which only a single instance should exist).b) this fails as both instances try to add the webjar GET handler.
The former can be counted as a minor inconvenience, the latter, however, is an easy fix which I will provide in due time.
The text was updated successfully, but these errors were encountered: