swagger.yml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. openapi: 3.0.0
  2. info:
  3. title: learning
  4. description: 培训考试
  5. version: 0.0.1
  6. paths:
  7. /Test.Nullable:
  8. post:
  9. tags:
  10. - 测试
  11. operationId: Test.Nullable
  12. summary: 测试空值参数
  13. requestBody:
  14. required: true
  15. content:
  16. application/json:
  17. schema:
  18. oneOf:
  19. - $ref: '#/components/schemas/Nullable'
  20. examples:
  21. AllPass:
  22. $ref: '#/components/examples/NullableReqAllPass'
  23. responses:
  24. 200:
  25. description: 请求成功
  26. content:
  27. application/json:
  28. examples:
  29. success:
  30. $ref: "#/components/examples/success"
  31. /LearningSkill.List:
  32. post:
  33. tags:
  34. - 考试培训-技能
  35. operationId: LearningSkill.List
  36. summary: 技能列表
  37. requestBody:
  38. required: true
  39. content:
  40. application/json:
  41. schema:
  42. oneOf:
  43. - $ref: '#/components/schemas/NoArgs'
  44. examples:
  45. NoArgs:
  46. $ref: '#/components/examples/NoArgs'
  47. responses:
  48. 200:
  49. description: 请求成功
  50. content:
  51. application/json:
  52. examples:
  53. success:
  54. $ref: "#/components/examples/success"
  55. /LearningSkill.Get:
  56. post:
  57. tags:
  58. - 考试培训-技能
  59. operationId: LearningSkill.Get
  60. summary: 技能详情
  61. requestBody:
  62. required: true
  63. content:
  64. application/json:
  65. schema:
  66. oneOf:
  67. - $ref: '#/components/schemas/LearningSkillGet'
  68. examples:
  69. LearningSkillGet:
  70. $ref: '#/components/examples/LearningSkillGet'
  71. responses:
  72. 200:
  73. description: 请求成功
  74. content:
  75. application/json:
  76. examples:
  77. success:
  78. $ref: "#/components/examples/success"
  79. /LearningSkill.Add:
  80. post:
  81. tags:
  82. - 考试培训-技能
  83. operationId: LearningSkill.Add
  84. summary: 添加技能
  85. requestBody:
  86. required: true
  87. content:
  88. application/json:
  89. schema:
  90. oneOf:
  91. - $ref: '#/components/schemas/LearningSkillAdd'
  92. examples:
  93. LearningSkillAdd:
  94. $ref: '#/components/examples/LearningSkillAdd'
  95. responses:
  96. 200:
  97. description: 请求成功
  98. content:
  99. application/json:
  100. examples:
  101. success:
  102. $ref: "#/components/examples/success"
  103. /LearningSkill.Update:
  104. post:
  105. tags:
  106. - 考试培训-技能
  107. operationId: LearningSkill.Update
  108. summary: 更新技能
  109. requestBody:
  110. required: true
  111. content:
  112. application/json:
  113. schema:
  114. oneOf:
  115. - $ref: '#/components/schemas/LearningSkillUpdate'
  116. examples:
  117. LearningSkillUpdate:
  118. $ref: '#/components/examples/LearningSkillUpdate'
  119. responses:
  120. 200:
  121. description: 请求成功
  122. content:
  123. application/json:
  124. examples:
  125. success:
  126. $ref: "#/components/examples/success"
  127. /LearningSkill.Delete:
  128. post:
  129. tags:
  130. - 考试培训-技能
  131. operationId: LearningSkill.Delete
  132. summary: 删除技能
  133. requestBody:
  134. required: true
  135. content:
  136. application/json:
  137. schema:
  138. oneOf:
  139. - $ref: '#/components/schemas/IdReq'
  140. examples:
  141. LearningSkillDelete:
  142. $ref: '#/components/examples/LearningSkillDelete'
  143. responses:
  144. 200:
  145. description: 请求成功
  146. content:
  147. application/json:
  148. examples:
  149. success:
  150. $ref: "#/components/examples/success"
  151. # 添加这个 swagger ui 会显示授权按钮
  152. security:
  153. - bearerAuth: []
  154. components:
  155. securitySchemes:
  156. basicAuth:
  157. type: http
  158. scheme: basic
  159. bearerAuth:
  160. type: http
  161. scheme: bearer
  162. schemas:
  163. Nullable:
  164. type: object
  165. required:
  166. - Str
  167. - Int
  168. - Bool
  169. - Slice
  170. properties:
  171. Str:
  172. type: string
  173. description: 字符串参数
  174. Int:
  175. type: integer
  176. description: Int 参数
  177. Bool:
  178. type: boolean
  179. description: Bool 参数
  180. Slice:
  181. type: array
  182. description: Slice 参数
  183. items:
  184. type: integer
  185. NoArgs:
  186. type: object
  187. properties:
  188. noargs:
  189. type: string
  190. description: 无参数,但是 body 中必须传输一个 json 空对象 "{}"
  191. LearningSkillGet:
  192. properties:
  193. id:
  194. type: string
  195. description: 技能 id
  196. name:
  197. type: string
  198. description: 技能名称
  199. LearningSkillAdd:
  200. properties:
  201. instrumentId:
  202. type: string
  203. description: 技能关联的设备 id
  204. name:
  205. type: string
  206. description: 技能名称
  207. LearningSkillUpdate:
  208. properties:
  209. id:
  210. type: string
  211. description: 技能 id
  212. instrumentId:
  213. type: string
  214. description: 技能关联的设备 id
  215. name:
  216. type: string
  217. description: 技能名称
  218. IdReq:
  219. type: object
  220. required:
  221. - id
  222. properties:
  223. id:
  224. type: integer
  225. description: ID
  226. examples:
  227. success:
  228. summary: 请求成功
  229. value:
  230. code: 200,
  231. msg: "success"
  232. NullableReqAllPass:
  233. value:
  234. Str: ""
  235. Int: 0
  236. Bool: false
  237. Slice: []
  238. NoArgs:
  239. value:
  240. noargs: ""
  241. LearningSkillGet:
  242. value:
  243. Id: 1
  244. LearningSkillAdd:
  245. value:
  246. name: 测试
  247. instrumentId: [1,2]
  248. LearningSkillUpdate:
  249. value:
  250. name: 测试更新
  251. instrumentId: [3,4]
  252. id: 1
  253. LearningSkillDelete:
  254. value:
  255. id: 1