swagger.json 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "description": "This is a sample server celler server.",
  5. "title": "Nunu Example API",
  6. "termsOfService": "http://swagger.io/terms/",
  7. "contact": {
  8. "name": "API Support",
  9. "url": "http://www.swagger.io/support",
  10. "email": "support@swagger.io"
  11. },
  12. "license": {
  13. "name": "Apache 2.0",
  14. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
  15. },
  16. "version": "1.0.0"
  17. },
  18. "host": "localhost:8000",
  19. "basePath": "/",
  20. "paths": {
  21. "/login": {
  22. "post": {
  23. "consumes": [
  24. "application/json"
  25. ],
  26. "produces": [
  27. "application/json"
  28. ],
  29. "tags": [
  30. "用户模块"
  31. ],
  32. "summary": "账号登录",
  33. "parameters": [
  34. {
  35. "description": "params",
  36. "name": "request",
  37. "in": "body",
  38. "required": true,
  39. "schema": {
  40. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_internal_pkg_request.LoginRequest"
  41. }
  42. }
  43. ],
  44. "responses": {
  45. "200": {
  46. "description": "OK",
  47. "schema": {
  48. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_internal_pkg_response.Response"
  49. }
  50. }
  51. }
  52. }
  53. },
  54. "/register": {
  55. "post": {
  56. "description": "目前只支持邮箱登录",
  57. "consumes": [
  58. "application/json"
  59. ],
  60. "produces": [
  61. "application/json"
  62. ],
  63. "tags": [
  64. "用户模块"
  65. ],
  66. "summary": "用户注册",
  67. "parameters": [
  68. {
  69. "description": "params",
  70. "name": "request",
  71. "in": "body",
  72. "required": true,
  73. "schema": {
  74. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_internal_pkg_request.RegisterRequest"
  75. }
  76. }
  77. ],
  78. "responses": {
  79. "200": {
  80. "description": "OK",
  81. "schema": {
  82. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_internal_pkg_response.Response"
  83. }
  84. }
  85. }
  86. }
  87. },
  88. "/user": {
  89. "get": {
  90. "security": [
  91. {
  92. "Bearer": []
  93. }
  94. ],
  95. "consumes": [
  96. "application/json"
  97. ],
  98. "produces": [
  99. "application/json"
  100. ],
  101. "tags": [
  102. "用户模块"
  103. ],
  104. "summary": "获取用户信息",
  105. "responses": {
  106. "200": {
  107. "description": "OK",
  108. "schema": {
  109. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_internal_pkg_response.Response"
  110. }
  111. }
  112. }
  113. }
  114. }
  115. },
  116. "definitions": {
  117. "github_com_go-nunu_nunu-layout-advanced_internal_pkg_request.LoginRequest": {
  118. "type": "object",
  119. "required": [
  120. "password",
  121. "username"
  122. ],
  123. "properties": {
  124. "password": {
  125. "type": "string",
  126. "example": "123456"
  127. },
  128. "username": {
  129. "type": "string",
  130. "example": "alan"
  131. }
  132. }
  133. },
  134. "github_com_go-nunu_nunu-layout-advanced_internal_pkg_request.RegisterRequest": {
  135. "type": "object",
  136. "required": [
  137. "email",
  138. "password",
  139. "username"
  140. ],
  141. "properties": {
  142. "email": {
  143. "type": "string",
  144. "example": "1234@gmail.com"
  145. },
  146. "password": {
  147. "type": "string",
  148. "example": "123456"
  149. },
  150. "username": {
  151. "type": "string",
  152. "example": "alan"
  153. }
  154. }
  155. },
  156. "github_com_go-nunu_nunu-layout-advanced_internal_pkg_response.Response": {
  157. "type": "object",
  158. "properties": {
  159. "code": {
  160. "type": "integer"
  161. },
  162. "data": {},
  163. "message": {
  164. "type": "string"
  165. }
  166. }
  167. }
  168. },
  169. "securityDefinitions": {
  170. "Bearer": {
  171. "type": "apiKey",
  172. "name": "Authorization",
  173. "in": "header"
  174. }
  175. }
  176. }