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
![image](https://private-user-images.githubusercontent.com/123525782/240142251-3f2b5179-3355-4a45-928e-1510b60c5b3a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxOTIxOTcsIm5iZiI6MTcyNDE5MTg5NywicGF0aCI6Ii8xMjM1MjU3ODIvMjQwMTQyMjUxLTNmMmI1MTc5LTMzNTUtNGE0NS05MjhlLTE1MTBiNjBjNWIzYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODIwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyMFQyMjExMzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hZjU3Zjc1YzNjZTk1MGQyYzdiOTE0ZGQzMjdmZWFhM2QyOWY3ZTZiZWM3YjdhZGQzYmEyNzczM2UwNzc4NGJhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.TuL0_c8KqbE7TjdZS4tqind0AGrhaidns2cFIXGplOQ)
"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: