docs.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
  2. // This file was generated by swaggo/swag
  3. package docs
  4. import (
  5. "bytes"
  6. "encoding/json"
  7. "strings"
  8. "github.com/alecthomas/template"
  9. "github.com/swaggo/swag"
  10. )
  11. var doc = `{
  12. "schemes": {{ marshal .Schemes }},
  13. "swagger": "2.0",
  14. "info": {
  15. "description": "{{.Description}}",
  16. "title": "{{.Title}}",
  17. "contact": {},
  18. "license": {},
  19. "version": "{{.Version}}"
  20. },
  21. "host": "{{.Host}}",
  22. "basePath": "{{.BasePath}}",
  23. "paths": {}
  24. }`
  25. type swaggerInfo struct {
  26. Version string
  27. Host string
  28. BasePath string
  29. Schemes []string
  30. Title string
  31. Description string
  32. }
  33. // SwaggerInfo holds exported Swagger Info so clients can modify it
  34. var SwaggerInfo = swaggerInfo{
  35. Version: "",
  36. Host: "",
  37. BasePath: "",
  38. Schemes: []string{},
  39. Title: "",
  40. Description: "",
  41. }
  42. type s struct{}
  43. func (s *s) ReadDoc() string {
  44. sInfo := SwaggerInfo
  45. sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
  46. t, err := template.New("swagger_info").Funcs(template.FuncMap{
  47. "marshal": func(v interface{}) string {
  48. a, _ := json.Marshal(v)
  49. return string(a)
  50. },
  51. }).Parse(doc)
  52. if err != nil {
  53. return doc
  54. }
  55. var tpl bytes.Buffer
  56. if err := t.Execute(&tpl, sInfo); err != nil {
  57. return doc
  58. }
  59. return tpl.String()
  60. }
  61. func init() {
  62. swag.Register(swag.Name, &s{})
  63. }