swagger.json 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "description": "go-admin",
  5. "title": "go-admin",
  6. "termsOfService": "https://github.com/kptyun/go-admin",
  7. "contact": {
  8. "name": "hequan",
  9. "url": "https://github.com/kptyun",
  10. "email": "hequan2011@sina.com"
  11. },
  12. "license": {
  13. "name": "MIT",
  14. "url": "https://github.com/kptyun/go-admin/blob/master/LICENSE"
  15. },
  16. "version": "1.1.2"
  17. },
  18. "basePath": "/api/v1",
  19. "paths": {
  20. "/api/v1/menus": {
  21. "get": {
  22. "consumes": [
  23. "application/json"
  24. ],
  25. "produces": [
  26. "application/json"
  27. ],
  28. "tags": [
  29. "menu"
  30. ],
  31. "summary": "获取所有菜单",
  32. "responses": {
  33. "200": {
  34. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  35. "schema": {
  36. "type": "string"
  37. }
  38. }
  39. }
  40. },
  41. "post": {
  42. "consumes": [
  43. "application/json"
  44. ],
  45. "produces": [
  46. "application/json"
  47. ],
  48. "tags": [
  49. "menu"
  50. ],
  51. "summary": "增加菜单",
  52. "parameters": [
  53. {
  54. "type": "string",
  55. "description": "name",
  56. "name": "name",
  57. "in": "query",
  58. "required": true
  59. },
  60. {
  61. "type": "string",
  62. "description": "path",
  63. "name": "path",
  64. "in": "query",
  65. "required": true
  66. }
  67. ],
  68. "responses": {
  69. "200": {
  70. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  71. "schema": {
  72. "type": "string"
  73. }
  74. }
  75. }
  76. }
  77. },
  78. "/api/v1/menus/": {
  79. "get": {
  80. "consumes": [
  81. "application/json"
  82. ],
  83. "produces": [
  84. "application/json"
  85. ],
  86. "tags": [
  87. "menu"
  88. ],
  89. "summary": "获取单个菜单",
  90. "parameters": [
  91. {
  92. "type": "string",
  93. "description": "id",
  94. "name": "id",
  95. "in": "path",
  96. "required": true
  97. }
  98. ],
  99. "responses": {
  100. "200": {
  101. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  102. "schema": {
  103. "type": "string"
  104. }
  105. }
  106. }
  107. },
  108. "put": {
  109. "consumes": [
  110. "application/json"
  111. ],
  112. "produces": [
  113. "application/json"
  114. ],
  115. "tags": [
  116. "menu"
  117. ],
  118. "summary": "更新菜单",
  119. "parameters": [
  120. {
  121. "type": "string",
  122. "description": "id",
  123. "name": "id",
  124. "in": "path",
  125. "required": true
  126. },
  127. {
  128. "type": "string",
  129. "description": "name",
  130. "name": "name",
  131. "in": "query",
  132. "required": true
  133. },
  134. {
  135. "type": "string",
  136. "description": "path",
  137. "name": "path",
  138. "in": "query",
  139. "required": true
  140. },
  141. {
  142. "type": "string",
  143. "description": "method",
  144. "name": "method",
  145. "in": "query",
  146. "required": true
  147. }
  148. ],
  149. "responses": {
  150. "200": {
  151. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  152. "schema": {
  153. "type": "string"
  154. }
  155. }
  156. }
  157. },
  158. "delete": {
  159. "consumes": [
  160. "application/json"
  161. ],
  162. "produces": [
  163. "application/json"
  164. ],
  165. "tags": [
  166. "menu"
  167. ],
  168. "summary": "删除菜单",
  169. "parameters": [
  170. {
  171. "type": "string",
  172. "description": "id",
  173. "name": "id",
  174. "in": "path",
  175. "required": true
  176. }
  177. ],
  178. "responses": {
  179. "200": {
  180. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  181. "schema": {
  182. "type": "string"
  183. }
  184. }
  185. }
  186. }
  187. },
  188. "/api/v1/roles": {
  189. "get": {
  190. "consumes": [
  191. "application/json"
  192. ],
  193. "produces": [
  194. "application/json"
  195. ],
  196. "tags": [
  197. "role"
  198. ],
  199. "summary": "获取所有角色",
  200. "responses": {
  201. "200": {
  202. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  203. "schema": {
  204. "type": "string"
  205. }
  206. }
  207. }
  208. },
  209. "post": {
  210. "consumes": [
  211. "application/json"
  212. ],
  213. "produces": [
  214. "application/json"
  215. ],
  216. "tags": [
  217. "role"
  218. ],
  219. "summary": "增加角色",
  220. "parameters": [
  221. {
  222. "type": "string",
  223. "description": "name",
  224. "name": "name",
  225. "in": "query",
  226. "required": true
  227. },
  228. {
  229. "type": "string",
  230. "description": "menu_id",
  231. "name": "menu_id",
  232. "in": "query",
  233. "required": true
  234. }
  235. ],
  236. "responses": {
  237. "200": {
  238. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  239. "schema": {
  240. "type": "string"
  241. }
  242. }
  243. }
  244. }
  245. },
  246. "/api/v1/roles/": {
  247. "get": {
  248. "consumes": [
  249. "application/json"
  250. ],
  251. "produces": [
  252. "application/json"
  253. ],
  254. "tags": [
  255. "role"
  256. ],
  257. "summary": "获取单个角色",
  258. "parameters": [
  259. {
  260. "type": "string",
  261. "description": "id",
  262. "name": "id",
  263. "in": "path",
  264. "required": true
  265. }
  266. ],
  267. "responses": {
  268. "200": {
  269. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  270. "schema": {
  271. "type": "string"
  272. }
  273. }
  274. }
  275. },
  276. "put": {
  277. "consumes": [
  278. "application/json"
  279. ],
  280. "produces": [
  281. "application/json"
  282. ],
  283. "tags": [
  284. "role"
  285. ],
  286. "summary": "更新角色",
  287. "parameters": [
  288. {
  289. "type": "string",
  290. "description": "id",
  291. "name": "id",
  292. "in": "path",
  293. "required": true
  294. },
  295. {
  296. "type": "string",
  297. "description": "name",
  298. "name": "name",
  299. "in": "query",
  300. "required": true
  301. },
  302. {
  303. "type": "string",
  304. "description": "menu_id",
  305. "name": "menu_id",
  306. "in": "query",
  307. "required": true
  308. }
  309. ],
  310. "responses": {
  311. "200": {
  312. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  313. "schema": {
  314. "type": "string"
  315. }
  316. }
  317. }
  318. },
  319. "delete": {
  320. "consumes": [
  321. "application/json"
  322. ],
  323. "produces": [
  324. "application/json"
  325. ],
  326. "tags": [
  327. "role"
  328. ],
  329. "summary": "删除角色",
  330. "parameters": [
  331. {
  332. "type": "string",
  333. "description": "id",
  334. "name": "id",
  335. "in": "path",
  336. "required": true
  337. }
  338. ],
  339. "responses": {
  340. "200": {
  341. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  342. "schema": {
  343. "type": "string"
  344. }
  345. }
  346. }
  347. }
  348. },
  349. "/api/v1/users": {
  350. "get": {
  351. "consumes": [
  352. "application/json"
  353. ],
  354. "produces": [
  355. "application/json"
  356. ],
  357. "tags": [
  358. "users"
  359. ],
  360. "summary": "获取所有用户",
  361. "parameters": [
  362. {}
  363. ],
  364. "responses": {
  365. "200": {
  366. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  367. "schema": {
  368. "type": "string"
  369. }
  370. }
  371. }
  372. },
  373. "post": {
  374. "consumes": [
  375. "application/json"
  376. ],
  377. "produces": [
  378. "application/json"
  379. ],
  380. "tags": [
  381. "users"
  382. ],
  383. "summary": "增加用户",
  384. "parameters": [
  385. {
  386. "description": "username",
  387. "name": "username",
  388. "in": "body",
  389. "required": true,
  390. "schema": {
  391. "type": "object"
  392. }
  393. },
  394. {
  395. "description": "password",
  396. "name": "password",
  397. "in": "body",
  398. "required": true,
  399. "schema": {
  400. "type": "object"
  401. }
  402. },
  403. {
  404. "type": "integer",
  405. "description": "role_id",
  406. "name": "role_id",
  407. "in": "path"
  408. }
  409. ],
  410. "responses": {
  411. "200": {
  412. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  413. "schema": {
  414. "type": "string"
  415. }
  416. }
  417. }
  418. }
  419. },
  420. "/api/v1/users/": {
  421. "get": {
  422. "consumes": [
  423. "application/json"
  424. ],
  425. "produces": [
  426. "application/json"
  427. ],
  428. "tags": [
  429. "users"
  430. ],
  431. "summary": "获取单个用户信息",
  432. "parameters": [
  433. {
  434. "type": "integer",
  435. "description": "id",
  436. "name": "id",
  437. "in": "path",
  438. "required": true
  439. }
  440. ],
  441. "responses": {
  442. "200": {
  443. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  444. "schema": {
  445. "type": "string"
  446. }
  447. }
  448. }
  449. },
  450. "put": {
  451. "consumes": [
  452. "application/json"
  453. ],
  454. "produces": [
  455. "application/json"
  456. ],
  457. "tags": [
  458. "users"
  459. ],
  460. "summary": "更新用户",
  461. "parameters": [
  462. {},
  463. {},
  464. {
  465. "type": "integer",
  466. "description": "role_id",
  467. "name": "role_id",
  468. "in": "query"
  469. }
  470. ],
  471. "responses": {
  472. "200": {
  473. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  474. "schema": {
  475. "type": "string"
  476. }
  477. }
  478. }
  479. },
  480. "delete": {
  481. "consumes": [
  482. "application/json"
  483. ],
  484. "produces": [
  485. "application/json"
  486. ],
  487. "tags": [
  488. "users"
  489. ],
  490. "summary": "删除用户",
  491. "parameters": [
  492. {
  493. "type": "integer",
  494. "description": "id",
  495. "name": "id",
  496. "in": "path",
  497. "required": true
  498. }
  499. ],
  500. "responses": {
  501. "200": {
  502. "description": "{ \"code\": 200, \"data\": {}, \"msg\": \"ok\" }",
  503. "schema": {
  504. "type": "string"
  505. }
  506. }
  507. }
  508. }
  509. },
  510. "/auth": {
  511. "post": {
  512. "consumes": [
  513. "application/json"
  514. ],
  515. "produces": [
  516. "application/json"
  517. ],
  518. "tags": [
  519. "auth"
  520. ],
  521. "summary": "获取登录token 信息",
  522. "parameters": [
  523. {
  524. "type": "string",
  525. "description": "username",
  526. "name": "username",
  527. "in": "path",
  528. "required": true
  529. },
  530. {
  531. "type": "string",
  532. "description": "password",
  533. "name": "password",
  534. "in": "path",
  535. "required": true
  536. }
  537. ],
  538. "responses": {
  539. "200": {
  540. "description": "{ \"code\": 200, \"data\": { \"token\": \"xxx\" }, \"msg\": \"ok\" }",
  541. "schema": {
  542. "type": "string"
  543. }
  544. },
  545. "400": {
  546. "description": "{\"code\":400, \"data\":null,\"msg\":\"请求参数错误\"}",
  547. "schema": {
  548. "type": "string"
  549. }
  550. },
  551. "404": {
  552. "description": "{ \"code\": 404, \"data\":null,\"msg\":\"请求参数错误\"}",
  553. "schema": {
  554. "type": "string"
  555. }
  556. }
  557. }
  558. }
  559. }
  560. }
  561. }