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

two or more swagger html on the same app #60

Open
srPuebla opened this issue Oct 27, 2021 · 5 comments
Open

two or more swagger html on the same app #60

srPuebla opened this issue Oct 27, 2021 · 5 comments
Labels

Comments

@srPuebla
Copy link

Hi,

In my app, i have endpoints published in the main app ( at the URL /swagger/ ) and i have another one, with admin endpoints (for example)

import (
echoSwagger "github.com/swaggo/echo-swagger"
...
)
On the main...:

	url := echoSwagger.URL("admin.json")
	echo.GET("/admin/swagger/*", echoSwagger.EchoWrapHandler(url))
	echo.GET("/swagger/*", echoSwagger.WrapHandler)

I am finding problems with this solution, cause each time that i load something of "/admin/swagger/", the main swagger stops to work.

Is posible to perform this?

Thanks!!

@ubogdan
Copy link
Contributor

ubogdan commented Oct 27, 2021

try

	url := echoSwagger.URL("admin.json")
	echo.GET("/admin/swagger/*", echoSwagger.EchoWrapHandler(url))
	echo.GET("/swagger/*", echoSwagger.EchoWrapHandler())

@srPuebla
Copy link
Author

try

	url := echoSwagger.URL("admin.json")
	echo.GET("/admin/swagger/*", echoSwagger.EchoWrapHandler(url))
	echo.GET("/swagger/*", echoSwagger.EchoWrapHandler())

Hi, thanks for reply so quickly.

I tried it, but when i load "admin" swagger on browser, the "main" swagger stops to works and it drops 404.
Maybe with this part of code is the problem:

var WrapHandler = EchoWrapHandler()

Thats why i am asking.

@ubogdan
Copy link
Contributor

ubogdan commented Oct 27, 2021

😄 Not really, the problem is caused by the fact we are reusing swaggerFiles.Handler.

@ubogdan ubogdan added the bug label Oct 27, 2021
@srPuebla
Copy link
Author

Thanks ubogdan for the fast reply!

@ubogdan
Copy link
Contributor

ubogdan commented Oct 27, 2021

The issue was addressed and the fix will be included in v1.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants