You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I a using the following code, when I did swag init and tried to view the swagger-ui, I am getting the following exception
"Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0)."
/ @title Car Track Service 2.0 API
// @version 2.0
// @description Car Track Service in Go using Gin framework.
// @contact.name *****
// @contact.email *******
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @BasePath /api
func main() {
fmt.Println("Starting...")
date := strconv.Itoa(time.Now().Year()) + fmt.Sprintf("%02d", time.Now().Month()) + fmt.Sprintf("%02d", time.Now().Day()) + strconv.Itoa(time.Now().Hour()) + fmt.Sprintf("%02d", time.Now().Minute())
docs.SwaggerInfo.Version = "Ver: 1.0, date: " + date
docs.SwaggerInfo.Host = cfg.Api_Url
ginServ := server.New(cfg, loggr)
api := ginServ.Group("/api")
controllers.AddCarTrackController(api)
ginServ.GET("/swagger/*any", FixRequestUri)
srv := &http.Server{
Addr: ":" + strconv.Itoa(cfg.Port),
Handler: ginServ,
}
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
loggr.Fatal("Cannot Start the HTTP Listener", zap.Error(err))
}
I tried to do update all versions but I could not resolve the issue. Has anyone got such issue and how can I fix this issue? Generated file seems to be ok.
The text was updated successfully, but these errors were encountered:
I also encountered this problem. However, I don't know how it happened. It didn't occur right from the start because it was working fine initially. As I kept writing code continuously without dealing with Swagger, it just happened on its own.
I a using the following code, when I did swag init and tried to view the swagger-ui, I am getting the following exception
"Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0)."
I tried to do update all versions but I could not resolve the issue. Has anyone got such issue and how can I fix this issue? Generated file seems to be ok.
The text was updated successfully, but these errors were encountered: