swagger.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. operationId: Test.Nullable
  10. summary: 测试空值参数
  11. requestBody:
  12. required: true
  13. content:
  14. application/json:
  15. schema:
  16. oneOf:
  17. - $ref: '#/components/schemas/Nullable'
  18. examples:
  19. AllPass:
  20. $ref: '#/components/examples/NullableReqAllPass'
  21. responses:
  22. 200:
  23. description: 请求成功
  24. content:
  25. application/json:
  26. examples:
  27. success:
  28. $ref: "#/components/examples/success"
  29. # 添加这个 swagger ui 会显示授权按钮
  30. security:
  31. - bearerAuth: []
  32. components:
  33. securitySchemes:
  34. basicAuth:
  35. type: http
  36. scheme: basic
  37. bearerAuth:
  38. type: http
  39. scheme: bearer
  40. schemas:
  41. Nullable:
  42. type: object
  43. required:
  44. - Str
  45. - Int
  46. - Bool
  47. - Slice
  48. properties:
  49. Str:
  50. type: string
  51. description: 字符串参数
  52. Int:
  53. type: integer
  54. description: Int 参数
  55. Bool:
  56. type: boolean
  57. description: Bool 参数
  58. Slice:
  59. type: array
  60. description: Slice 参数
  61. items:
  62. type: integer
  63. examples:
  64. success:
  65. summary: 请求成功
  66. value:
  67. code: 200,
  68. msg: "success"
  69. NullableReqAllPass:
  70. value:
  71. Str: ""
  72. Int: 0
  73. Bool: false
  74. Slice: []