Add OpenAPI endpoint at /openapi with Swagger documentation
This commit is contained in:
+12
-6
@@ -87,12 +87,12 @@ type swaggerInfo struct {
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = swaggerInfo{
|
||||
Version: "",
|
||||
Host: "",
|
||||
BasePath: "",
|
||||
Schemes: []string{},
|
||||
Title: "",
|
||||
Description: "",
|
||||
Version: "1.0",
|
||||
Host: "localhost:8080",
|
||||
BasePath: "/",
|
||||
Schemes: []string{"http", "https"},
|
||||
Title: "MusicServer API",
|
||||
Description: "API for the MusicServer application",
|
||||
}
|
||||
|
||||
type s struct{}
|
||||
@@ -129,3 +129,9 @@ func (s *s) ReadDoc() string {
|
||||
func init() {
|
||||
swag.Register("swagger", &s{})
|
||||
}
|
||||
|
||||
// GetSwaggerJSON returns the swagger JSON
|
||||
func GetSwaggerJSON() string {
|
||||
s := &s{}
|
||||
return s.ReadDoc()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user