Hi,
Not sure if this is real bug or I'm missing something.
The link below title doc.json is pointing to blank page. Also the json file which is getting created is with name swgger.json then why this link is to doc.json.
Expected behavior
This link should open the json file in new window.

swag version v1.3.2
You probably need to change this.
Do you have any good ideas?
https://github.com/swaggo/gin-swagger/blob/e18d29b0785c2a1c7c29dca268e0bb15d8acdcef/swagger.go#L37-L39
Click the link will open a about:blank page, it doesn't open the url "http://localhost:8080/x/apidocs/doc.json", directly access the url is ok.
I have the same behavior with swag version v1.4.0. Is there a workaround for this issue?
In the meantime I use
// @description JSON API definition can be retrieved at <a href="/api/v1/swagger/doc.json">/api/v1/swagger/doc.json</a>
as a workaround.
Fixed via https://github.com/swaggo/gin-swagger/pull/48
Now you can use ginSwagger.Config to point out API doc link:
func main() {
r := gin.New()
config := &ginSwagger.Config{
URL: "http://localhost:8080/swagger/doc.json", //The url pointing to API definition
}
// use ginSwagger middleware to
r.GET("/swagger/*any", ginSwagger. CustomWrapHandler(config, swaggerFiles.Handler))
r.Run()
}
Uhmm, that's good that the issue got fixed for Gin, but what about the users who do not use Gin?
I also would like to have the working doc.json link with httpSwagger.WrapHandler.
Just adding a dot in the beginning of the path seems to fix the issue
rs.Handle("/swagger/*", httpSwagger.Handler(
httpSwagger.URL("./swagger/doc.json"),
)
)
Would appreciate it if there's a solution for echoSwagger
there you go e.GET("/swagger/*", echoSwagger.EchoWrapHandler(func(c *echoSwagger.Config) { c.URL = "./swagger/doc.json" }))
Most helpful comment
Just adding a dot in the beginning of the path seems to fix the issue