Swagger UI generator for Echo framework
.gitignore | ||
.travis.yml | ||
assets.go | ||
converter.go | ||
generator.go | ||
internal_test.go | ||
internal.go | ||
LICENSE | ||
models.go | ||
README.md | ||
security_test.go | ||
security.go | ||
spec_test.go | ||
spec.go | ||
tag_test.go | ||
tag.go | ||
utils.go | ||
validator.go | ||
wrapper_test.go | ||
wrapper.go |
echoswagger
Swagger UI generator for Echo framework
Feature
- No SwaggerUI html/css dependency
- Highly integrated with echo, low intrusive design
- Take advantage of the strong typing language to make it easy to use
- Recycle garbage in time, low memory usage
Example
package main
import (
"net/http"
"github.com/elvinchan/echoswagger"
"github.com/labstack/echo"
)
func main() {
// ApiRoot with Echo instance
e := echoswagger.New(echo.New(), "/v2", "doc/", nil)
// Routes with parameters & responses
e.POST("/", createUser).
AddParamBody(User{}, "body", "User input struct", true).
AddResponse(http.StatusCreated, "successful", nil, nil)
// Start server
e.Echo().Logger.Fatal(e.Echo().Start(":1323"))
}
type User struct {
Name string
}
// Handler
func createUser(c echo.Context) error {
return c.JSON(http.StatusCreated, nil)
}