swagger.json 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "contact": {},
  5. "license": {}
  6. },
  7. "paths": {
  8. "/api/v1/demos/": {
  9. "post": {
  10. "tags": [
  11. "API-Demo"
  12. ],
  13. "summary": "创建数据",
  14. "parameters": [
  15. {
  16. "description": "提交的数据",
  17. "name": "body",
  18. "in": "body",
  19. "required": true,
  20. "schema": {
  21. "$ref": "#/definitions/schema.Demo"
  22. }
  23. }
  24. ],
  25. "responses": {
  26. "200": {
  27. "description": "OK",
  28. "schema": {
  29. "$ref": "#/definitions/schema.Demo"
  30. }
  31. },
  32. "400": {
  33. "description": "{error:{code:0,message:无效的请求参数}}",
  34. "schema": {
  35. "$ref": "#/definitions/schema.HTTPError"
  36. }
  37. },
  38. "401": {
  39. "description": "{error:{code:0,message:未授权}}",
  40. "schema": {
  41. "$ref": "#/definitions/schema.HTTPError"
  42. }
  43. },
  44. "500": {
  45. "description": "{error:{code:0,message:服务器错误}}",
  46. "schema": {
  47. "$ref": "#/definitions/schema.HTTPError"
  48. }
  49. }
  50. }
  51. }
  52. }
  53. },
  54. "definitions": {
  55. "schema.Demo": {
  56. "type": "object",
  57. "properties": {
  58. "code": {
  59. "description": "编号",
  60. "type": "string"
  61. },
  62. "created_at": {
  63. "description": "创建时间",
  64. "type": "string"
  65. },
  66. "creator": {
  67. "description": "创建者",
  68. "type": "string"
  69. },
  70. "memo": {
  71. "description": "备注",
  72. "type": "string"
  73. },
  74. "name": {
  75. "description": "名称",
  76. "type": "string"
  77. },
  78. "record_id": {
  79. "description": "记录ID",
  80. "type": "string"
  81. },
  82. "status": {
  83. "description": "状态(1:启用 2:停用)",
  84. "type": "integer"
  85. }
  86. }
  87. },
  88. "schema.HTTPError": {
  89. "type": "object",
  90. "properties": {
  91. "error": {
  92. "description": "错误项",
  93. "type": "object",
  94. "$ref": "#/definitions/schema.HTTPErrorItem"
  95. }
  96. }
  97. },
  98. "schema.HTTPErrorItem": {
  99. "type": "object",
  100. "properties": {
  101. "code": {
  102. "description": "错误码",
  103. "type": "integer"
  104. },
  105. "message": {
  106. "description": "错误信息",
  107. "type": "string"
  108. },
  109. "trace_id": {
  110. "description": "追踪Id,用于快速定位错误",
  111. "type": "string"
  112. }
  113. }
  114. }
  115. }
  116. }