227 lines
7.8 KiB
YAML

components:
responses:
# 成功响应
Success:
description: 操作成功
content:
application/xml:
schema:
$ref: './schemas.yaml#/components/schemas/BaseResponse'
example: |
<?xml version="1.0" encoding="GBK"?>
<out>
<Version>1.0.1</Version>
<InstId>00001</InstId>
<TranCode>QueryRes</TranCode>
<TranDate>20240101</TranDate>
<TranSeq>123456789012</TranSeq>
<RespCode>AAAAAAA</RespCode>
<RespMessage>成功</RespMessage>
</out>
application/json:
schema:
$ref: './schemas.yaml#/components/schemas/BaseResponse'
example:
Version: "1.0.1"
InstId: "00001"
TranCode: "QueryRes"
TranDate: "20240101"
TranSeq: "123456789012"
RespCode: "AAAAAAA"
RespMessage: "成功"
# 业务错误响应
BusinessError:
description: 业务处理错误
content:
application/xml:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example: |
<?xml version="1.0" encoding="GBK"?>
<out>
<Version>1.0.1</Version>
<InstId>00001</InstId>
<TranCode>QueryRes</TranCode>
<TranDate>20240101</TranDate>
<TranSeq>123456789012</TranSeq>
<RespCode>DEF0001</RespCode>
<RespMessage>无相应记录</RespMessage>
<ErrorDetail>
<ErrorCode>DEF0001</ErrorCode>
<ErrorMsg>用户编号123456不存在</ErrorMsg>
<ErrorTime>2024-01-01 12:00:00</ErrorTime>
</ErrorDetail>
</out>
application/json:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example:
Version: "1.0.1"
InstId: "00001"
TranCode: "QueryRes"
TranDate: "20240101"
TranSeq: "123456789012"
RespCode: "DEF0001"
RespMessage: "无相应记录"
ErrorDetail:
ErrorCode: "DEF0001"
ErrorMsg: "用户编号123456不存在"
ErrorTime: "2024-01-01T12:00:00.000Z"
# 系统错误响应
SystemError:
description: 系统异常错误
content:
application/xml:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example: |
<?xml version="1.0" encoding="GBK"?>
<out>
<Version>1.0.1</Version>
<InstId>00001</InstId>
<TranCode>QueryRes</TranCode>
<TranDate>20240101</TranDate>
<TranSeq>123456789012</TranSeq>
<RespCode>SYS1001</RespCode>
<RespMessage>系统异常</RespMessage>
<ErrorDetail>
<ErrorCode>SYS1001</ErrorCode>
<ErrorMsg>数据库连接失败</ErrorMsg>
<ErrorTime>2024-01-01 12:00:00</ErrorTime>
</ErrorDetail>
</out>
application/json:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example:
Version: "1.0.1"
InstId: "00001"
TranCode: "QueryRes"
TranDate: "20240101"
TranSeq: "123456789012"
RespCode: "SYS1001"
RespMessage: "系统异常"
ErrorDetail:
ErrorCode: "SYS1001"
ErrorMsg: "数据库连接失败"
ErrorTime: "2024-01-01T12:00:00.000Z"
# 安全错误响应
SecurityError:
description: 安全验证错误
content:
application/xml:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example: |
<?xml version="1.0" encoding="GBK"?>
<out>
<Version>1.0.1</Version>
<InstId>00001</InstId>
<TranCode>QueryRes</TranCode>
<TranDate>20240101</TranDate>
<TranSeq>123456789012</TranSeq>
<RespCode>SEC2001</RespCode>
<RespMessage>加密验证失败</RespMessage>
<ErrorDetail>
<ErrorCode>SEC2001</ErrorCode>
<ErrorMsg>数据解密失败</ErrorMsg>
<ErrorTime>2024-01-01 12:00:00</ErrorTime>
</ErrorDetail>
</out>
application/json:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example:
Version: "1.0.1"
InstId: "00001"
TranCode: "QueryRes"
TranDate: "20240101"
TranSeq: "123456789012"
RespCode: "SEC2001"
RespMessage: "加密验证失败"
ErrorDetail:
ErrorCode: "SEC2001"
ErrorMsg: "数据解密失败"
ErrorTime: "2024-01-01T12:00:00.000Z"
# 网络错误响应
NetworkError:
description: 网络通信错误
content:
application/xml:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example: |
<?xml version="1.0" encoding="GBK"?>
<out>
<Version>1.0.1</Version>
<InstId>00001</InstId>
<TranCode>QueryRes</TranCode>
<TranDate>20240101</TranDate>
<TranSeq>123456789012</TranSeq>
<RespCode>NET3001</RespCode>
<RespMessage>网络超时</RespMessage>
<ErrorDetail>
<ErrorCode>NET3001</ErrorCode>
<ErrorMsg>请求超时,请稍后重试</ErrorMsg>
<ErrorTime>2024-01-01 12:00:00</ErrorTime>
</ErrorDetail>
</out>
application/json:
schema:
allOf:
- $ref: './schemas.yaml#/components/schemas/BaseResponse'
- type: object
properties:
ErrorDetail:
$ref: './schemas.yaml#/components/schemas/ErrorDetail'
example:
Version: "1.0.1"
InstId: "00001"
TranCode: "QueryRes"
TranDate: "20240101"
TranSeq: "123456789012"
RespCode: "NET3001"
RespMessage: "网络超时"
ErrorDetail:
ErrorCode: "NET3001"
ErrorMsg: "请求超时,请稍后重试"
ErrorTime: "2024-01-01T12:00:00.000Z"