openapi: 3.0.0 info: title: learning description: 培训考试 version: 0.0.1 paths: /Test.Nullable: post: operationId: Test.Nullable summary: 测试空值参数 requestBody: required: true content: application/json: schema: oneOf: - $ref: '#/components/schemas/Nullable' examples: AllPass: $ref: '#/components/examples/NullableReqAllPass' responses: 200: description: 请求成功 content: application/json: examples: success: $ref: "#/components/examples/success" # 添加这个 swagger ui 会显示授权按钮 security: - bearerAuth: [] components: securitySchemes: basicAuth: type: http scheme: basic bearerAuth: type: http scheme: bearer schemas: Nullable: type: object required: - Str - Int - Bool - Slice properties: Str: type: string description: 字符串参数 Int: type: integer description: Int 参数 Bool: type: boolean description: Bool 参数 Slice: type: array description: Slice 参数 items: type: integer examples: success: summary: 请求成功 value: code: 200, msg: "success" NullableReqAllPass: value: Str: "" Int: 0 Bool: false Slice: []