go-gin-example/docs/docs.go

166 lines
4.4 KiB
Go

// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/tags": {
"post": {
"produces": [
"application/json"
],
"summary": "新增文章标签",
"parameters": [
{
"type": "string",
"description": "TOKEN",
"name": "token",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
},
{
"type": "integer",
"description": "CreatedBy",
"name": "created_by",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/tags/{id}": {
"put": {
"produces": [
"application/json"
],
"summary": "修改文章标签",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "ID",
"name": "name",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
},
{
"type": "string",
"description": "ModifiedBy",
"name": "modified_by",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}