docs.go 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
  2. // This file was generated by swaggo/swag at
  3. // 2021-01-08 16:28:24.8381164 +0800 CST m=+0.073999901
  4. package docs
  5. import (
  6. "bytes"
  7. "encoding/json"
  8. "strings"
  9. "github.com/alecthomas/template"
  10. "github.com/swaggo/swag"
  11. )
  12. var doc = `{
  13. "schemes": {{ marshal .Schemes }},
  14. "swagger": "2.0",
  15. "info": {
  16. "description": "{{.Description}}",
  17. "title": "{{.Title}}",
  18. "termsOfService": "http://swagger.io/terms/",
  19. "contact": {
  20. "name": "API Support",
  21. "url": "http://www.swagger.io/support",
  22. "email": "support@swagger.io"
  23. },
  24. "license": {
  25. "name": "Apache 2.0",
  26. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
  27. },
  28. "version": "{{.Version}}"
  29. },
  30. "host": "{{.Host}}",
  31. "basePath": "{{.BasePath}}",
  32. "paths": {
  33. "/Auth/SignUp": {
  34. "post": {
  35. "description": "用户添加",
  36. "consumes": [
  37. "application/x-www-form-urlencoded"
  38. ],
  39. "produces": [
  40. "application/json"
  41. ],
  42. "tags": [
  43. "Auth"
  44. ],
  45. "summary": "用户添加",
  46. "parameters": [
  47. {
  48. "type": "string",
  49. "description": "用户名",
  50. "name": "userCode",
  51. "in": "formData",
  52. "required": true
  53. },
  54. {
  55. "type": "string",
  56. "description": "密码",
  57. "name": "password",
  58. "in": "formData",
  59. "required": true
  60. },
  61. {
  62. "type": "string",
  63. "description": "邮箱",
  64. "name": "email",
  65. "in": "formData"
  66. },
  67. {
  68. "type": "string",
  69. "description": "手机号",
  70. "name": "phone",
  71. "in": "formData"
  72. },
  73. {
  74. "type": "string",
  75. "description": "姓名",
  76. "name": "name",
  77. "in": "formData"
  78. }
  79. ],
  80. "responses": {
  81. "200": {
  82. "description": "OK",
  83. "schema": {
  84. "$ref": "#/definitions/controller.ResponseBase"
  85. }
  86. }
  87. }
  88. }
  89. }
  90. },
  91. "definitions": {
  92. "controller.ResponseBase": {
  93. "type": "object",
  94. "properties": {
  95. "code": {
  96. "type": "integer"
  97. },
  98. "memo": {
  99. "type": "string"
  100. }
  101. }
  102. }
  103. },
  104. "securityDefinitions": {
  105. "ApiKeyAuth": {
  106. "type": "apiKey",
  107. "name": "Authorization",
  108. "in": "header"
  109. },
  110. "BasicAuth": {
  111. "type": "basic"
  112. },
  113. "OAuth2AccessCode": {
  114. "type": "oauth2",
  115. "flow": "accessCode",
  116. "authorizationUrl": "https://example.com/oauth/authorize",
  117. "tokenUrl": "https://example.com/oauth/token",
  118. "scopes": {
  119. "admin": " Grants read and write access to administrative information"
  120. }
  121. },
  122. "OAuth2Application": {
  123. "type": "oauth2",
  124. "flow": "application",
  125. "tokenUrl": "https://example.com/oauth/token",
  126. "scopes": {
  127. "admin": " Grants read and write access to administrative information",
  128. "write": " Grants write access"
  129. }
  130. },
  131. "OAuth2Implicit": {
  132. "type": "oauth2",
  133. "flow": "implicit",
  134. "authorizationUrl": "https://example.com/oauth/authorize",
  135. "scopes": {
  136. "admin": " Grants read and write access to administrative information",
  137. "write": " Grants write access"
  138. }
  139. },
  140. "OAuth2Password": {
  141. "type": "oauth2",
  142. "flow": "password",
  143. "tokenUrl": "https://example.com/oauth/token",
  144. "scopes": {
  145. "admin": " Grants read and write access to administrative information",
  146. "read": " Grants read access",
  147. "write": " Grants write access"
  148. }
  149. }
  150. }
  151. }`
  152. type swaggerInfo struct {
  153. Version string
  154. Host string
  155. BasePath string
  156. Schemes []string
  157. Title string
  158. Description string
  159. }
  160. // SwaggerInfo holds exported Swagger Info so clients can modify it
  161. var SwaggerInfo = swaggerInfo{
  162. Version: "1.0",
  163. Host: "",
  164. BasePath: "/v1",
  165. Schemes: []string{},
  166. Title: "web框架",
  167. Description: "web框架 API 文档",
  168. }
  169. type s struct{}
  170. func (s *s) ReadDoc() string {
  171. sInfo := SwaggerInfo
  172. sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
  173. t, err := template.New("swagger_info").Funcs(template.FuncMap{
  174. "marshal": func(v interface{}) string {
  175. a, _ := json.Marshal(v)
  176. return string(a)
  177. },
  178. }).Parse(doc)
  179. if err != nil {
  180. return doc
  181. }
  182. var tpl bytes.Buffer
  183. if err := t.Execute(&tpl, sInfo); err != nil {
  184. return doc
  185. }
  186. return tpl.String()
  187. }
  188. func init() {
  189. swag.Register(swag.Name, &s{})
  190. }