|
| 1 | +// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT |
| 2 | +// This file was generated by swaggo/swag |
| 3 | +package docs |
| 4 | + |
| 5 | +import ( |
| 6 | + "bytes" |
| 7 | + "encoding/json" |
| 8 | + "strings" |
| 9 | + "text/template" |
| 10 | + |
| 11 | + "github.com/swaggo/swag" |
| 12 | +) |
| 13 | + |
| 14 | +var doc = `{ |
| 15 | + "schemes": {{ marshal .Schemes }}, |
| 16 | + "swagger": "2.0", |
| 17 | + "info": { |
| 18 | + "description": "{{escape .Description}}", |
| 19 | + "title": "{{.Title}}", |
| 20 | + "contact": {}, |
| 21 | + "version": "{{.Version}}" |
| 22 | + }, |
| 23 | + "host": "{{.Host}}", |
| 24 | + "basePath": "{{.BasePath}}", |
| 25 | + "paths": { |
| 26 | + "/system/version": { |
| 27 | + "get": { |
| 28 | + "description": "查询脚本猫版本信息", |
| 29 | + "consumes": [ |
| 30 | + "application/json" |
| 31 | + ], |
| 32 | + "produces": [ |
| 33 | + "application/json" |
| 34 | + ], |
| 35 | + "tags": [ |
| 36 | + "system" |
| 37 | + ], |
| 38 | + "summary": "系统", |
| 39 | + "operationId": "system", |
| 40 | + "responses": { |
| 41 | + "200": { |
| 42 | + "description": "OK", |
| 43 | + "schema": { |
| 44 | + "$ref": "#/definitions/repository.ScriptCatInfo" |
| 45 | + } |
| 46 | + }, |
| 47 | + "400": { |
| 48 | + "description": "Bad Request", |
| 49 | + "schema": { |
| 50 | + "$ref": "#/definitions/errs.JsonRespondError" |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + } |
| 56 | + }, |
| 57 | + "definitions": { |
| 58 | + "errs.JsonRespondError": { |
| 59 | + "type": "object", |
| 60 | + "properties": { |
| 61 | + "code": { |
| 62 | + "type": "integer" |
| 63 | + }, |
| 64 | + "msg": { |
| 65 | + "type": "string" |
| 66 | + } |
| 67 | + } |
| 68 | + }, |
| 69 | + "repository.ScriptCatInfo": { |
| 70 | + "type": "object", |
| 71 | + "properties": { |
| 72 | + "message": { |
| 73 | + "type": "string" |
| 74 | + }, |
| 75 | + "version": { |
| 76 | + "type": "string" |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | +}` |
| 82 | + |
| 83 | +type swaggerInfo struct { |
| 84 | + Version string |
| 85 | + Host string |
| 86 | + BasePath string |
| 87 | + Schemes []string |
| 88 | + Title string |
| 89 | + Description string |
| 90 | +} |
| 91 | + |
| 92 | +// SwaggerInfo holds exported Swagger Info so clients can modify it |
| 93 | +var SwaggerInfo = swaggerInfo{ |
| 94 | + Version: "1.0", |
| 95 | + Host: "localhost:8080", |
| 96 | + BasePath: "/api/v1", |
| 97 | + Schemes: []string{}, |
| 98 | + Title: "云猫api文档", |
| 99 | + Description: "", |
| 100 | +} |
| 101 | + |
| 102 | +type s struct{} |
| 103 | + |
| 104 | +func (s *s) ReadDoc() string { |
| 105 | + sInfo := SwaggerInfo |
| 106 | + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) |
| 107 | + |
| 108 | + t, err := template.New("swagger_info").Funcs(template.FuncMap{ |
| 109 | + "marshal": func(v interface{}) string { |
| 110 | + a, _ := json.Marshal(v) |
| 111 | + return string(a) |
| 112 | + }, |
| 113 | + "escape": func(v interface{}) string { |
| 114 | + // escape tabs |
| 115 | + str := strings.Replace(v.(string), "\t", "\\t", -1) |
| 116 | + // replace " with \", and if that results in \\", replace that with \\\" |
| 117 | + str = strings.Replace(str, "\"", "\\\"", -1) |
| 118 | + return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1) |
| 119 | + }, |
| 120 | + }).Parse(doc) |
| 121 | + if err != nil { |
| 122 | + return doc |
| 123 | + } |
| 124 | + |
| 125 | + var tpl bytes.Buffer |
| 126 | + if err := t.Execute(&tpl, sInfo); err != nil { |
| 127 | + return doc |
| 128 | + } |
| 129 | + |
| 130 | + return tpl.String() |
| 131 | +} |
| 132 | + |
| 133 | +func init() { |
| 134 | + swag.Register(swag.Name, &s{}) |
| 135 | +} |
0 commit comments