docs.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
  2. // This file was generated by swaggo/swag at
  3. // 2019-09-02 17:34:00.7260773 +0800 CST m=+0.033907001
  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. "contact": {},
  19. "license": {},
  20. "version": "{{.Version}}"
  21. },
  22. "host": "{{.Host}}",
  23. "basePath": "{{.BasePath}}",
  24. "paths": {
  25. "/user/regist": {
  26. "post": {
  27. "produces": [
  28. "application/x-www-form-urlencoded"
  29. ],
  30. "summary": "创建用户",
  31. "parameters": [
  32. {
  33. "description": "用户注册接口",
  34. "name": "data",
  35. "in": "body",
  36. "required": true,
  37. "schema": {
  38. "type": "object",
  39. "$ref": "#/definitions/api.RegistStuct"
  40. }
  41. }
  42. ],
  43. "responses": {
  44. "200": {
  45. "description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
  46. "schema": {
  47. "type": "string"
  48. }
  49. }
  50. }
  51. }
  52. }
  53. },
  54. "definitions": {
  55. "api.RegistStuct": {
  56. "type": "object",
  57. "properties": {
  58. "passWord": {
  59. "type": "string"
  60. },
  61. "userName": {
  62. "type": "string"
  63. }
  64. }
  65. }
  66. }
  67. }`
  68. type swaggerInfo struct {
  69. Version string
  70. Host string
  71. BasePath string
  72. Schemes []string
  73. Title string
  74. Description string
  75. }
  76. // SwaggerInfo holds exported Swagger Info so clients can modify it
  77. var SwaggerInfo = swaggerInfo{
  78. Version: "",
  79. Host: "",
  80. BasePath: "",
  81. Schemes: []string{},
  82. Title: "",
  83. Description: "",
  84. }
  85. type s struct{}
  86. func (s *s) ReadDoc() string {
  87. sInfo := SwaggerInfo
  88. sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
  89. t, err := template.New("swagger_info").Funcs(template.FuncMap{
  90. "marshal": func(v interface{}) string {
  91. a, _ := json.Marshal(v)
  92. return string(a)
  93. },
  94. }).Parse(doc)
  95. if err != nil {
  96. return doc
  97. }
  98. var tpl bytes.Buffer
  99. if err := t.Execute(&tpl, sInfo); err != nil {
  100. return doc
  101. }
  102. return tpl.String()
  103. }
  104. func init() {
  105. swag.Register(swag.Name, &s{})
  106. }