2020-12-27 20:40:43 +08:00
|
|
|
|
// 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": {},
|
|
|
|
|
|
"version": "{{.Version}}"
|
|
|
|
|
|
},
|
|
|
|
|
|
"host": "{{.Host}}",
|
|
|
|
|
|
"basePath": "{{.BasePath}}",
|
|
|
|
|
|
"paths": {
|
|
|
|
|
|
"/demo/user/{name}": {
|
|
|
|
|
|
"get": {
|
|
|
|
|
|
"description": "获取用户信息",
|
|
|
|
|
|
"consumes": [
|
|
|
|
|
|
"application/json"
|
|
|
|
|
|
],
|
|
|
|
|
|
"produces": [
|
|
|
|
|
|
"application/json"
|
|
|
|
|
|
],
|
|
|
|
|
|
"tags": [
|
|
|
|
|
|
"Demo"
|
|
|
|
|
|
],
|
|
|
|
|
|
"summary": "获取用户信息",
|
|
|
|
|
|
"parameters": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"type": "string",
|
2021-01-01 10:51:55 +08:00
|
|
|
|
"description": "用户名(Tom)",
|
2020-12-27 20:40:43 +08:00
|
|
|
|
"name": "name",
|
|
|
|
|
|
"in": "path",
|
|
|
|
|
|
"required": true
|
2021-01-01 10:51:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"type": "string",
|
|
|
|
|
|
"description": "签名",
|
|
|
|
|
|
"name": "Authorization",
|
|
|
|
|
|
"in": "header",
|
|
|
|
|
|
"required": true
|
2020-12-27 20:40:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"responses": {
|
|
|
|
|
|
"200": {
|
|
|
|
|
|
"description": "用户信息",
|
|
|
|
|
|
"schema": {
|
|
|
|
|
|
"type": "array",
|
|
|
|
|
|
"items": {
|
|
|
|
|
|
"type": "object",
|
|
|
|
|
|
"properties": {
|
|
|
|
|
|
"job": {
|
|
|
|
|
|
"description": "工作",
|
|
|
|
|
|
"type": "string"
|
|
|
|
|
|
},
|
|
|
|
|
|
"name": {
|
|
|
|
|
|
"description": "用户名",
|
|
|
|
|
|
"type": "string"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-01-01 10:51:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
"/user/login": {
|
|
|
|
|
|
"post": {
|
|
|
|
|
|
"description": "登录获取 Authorization 码",
|
|
|
|
|
|
"consumes": [
|
|
|
|
|
|
"application/json"
|
|
|
|
|
|
],
|
|
|
|
|
|
"produces": [
|
|
|
|
|
|
"application/json"
|
|
|
|
|
|
],
|
|
|
|
|
|
"tags": [
|
|
|
|
|
|
"Demo"
|
|
|
|
|
|
],
|
|
|
|
|
|
"summary": "登录获取 Authorization 码",
|
|
|
|
|
|
"parameters": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"description": "请求信息",
|
|
|
|
|
|
"name": "loginRequest",
|
|
|
|
|
|
"in": "body",
|
|
|
|
|
|
"required": true,
|
|
|
|
|
|
"schema": {
|
|
|
|
|
|
"$ref": "#/definitions/demo.loginRequest"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"responses": {
|
|
|
|
|
|
"200": {
|
|
|
|
|
|
"description": "签名信息",
|
|
|
|
|
|
"schema": {
|
|
|
|
|
|
"$ref": "#/definitions/demo.loginResponse"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"definitions": {
|
|
|
|
|
|
"demo.loginRequest": {
|
|
|
|
|
|
"type": "object",
|
|
|
|
|
|
"properties": {
|
|
|
|
|
|
"user_id": {
|
|
|
|
|
|
"description": "用户ID(\u003e0)",
|
|
|
|
|
|
"type": "integer"
|
|
|
|
|
|
},
|
|
|
|
|
|
"user_name": {
|
|
|
|
|
|
"description": "用户名",
|
|
|
|
|
|
"type": "string"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"demo.loginResponse": {
|
|
|
|
|
|
"type": "object",
|
|
|
|
|
|
"properties": {
|
|
|
|
|
|
"authorization": {
|
|
|
|
|
|
"description": "签名",
|
|
|
|
|
|
"type": "string"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-27 20:40:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
|
|
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: "",
|
2021-01-01 10:51:55 +08:00
|
|
|
|
Host: "127.0.0.1:9999",
|
2020-12-27 20:40:43 +08:00
|
|
|
|
BasePath: "",
|
|
|
|
|
|
Schemes: []string{},
|
|
|
|
|
|
Title: "go-gin-api docs api",
|
|
|
|
|
|
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{})
|
|
|
|
|
|
}
|