I was working on documentation for APIs. I've used Go-Swagger for the same. It's working for regular Docs but not for Redoc.
Here are my implementation details:
router.StaticFile("/swagger", "./api/swagger.yaml")
opts := middleware.SwaggerUIOpts{SpecURL: "/swagger", Path: "/docs"}
sh := middleware.SwaggerUI(opts, nil)
router.GET("/docs", func(ctx *gin.Context) {
sh.ServeHTTP(ctx.Writer, ctx.Request)
})
opts1 := middleware.RedocOpts{SpecURL: "/swagger", Path: "/redoc"}
sh1 := middleware.Redoc(opts1, nil)
router.GET("/redoc", func(ctx *gin.Context) {
sh1.ServeHTTP(ctx.Writer, ctx.Request)
})
As you can see, the docs are working correctly:
But I'm facing issues with redoc:
I also tried to load different library for Redoc: "https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js" but it too did not work.
I'm using this command to generate the swagger.yaml file:
swagger generate spec -o ./api/swagger.json --scan-models
Please let me know what's the actual issue. I'm not able to find anything. Thanks