【发布时间】:2019-01-29 09:51:02
【问题描述】:
我的 API 可以返回 200 ok 或 400,发生错误。我希望他们都使用相同的模型,但使用不同的示例。在下面的代码中,我希望我的 200 信息说“一切正常”和 400 的信息“不正常”。
responses:
'200':
description: >-
Invoice received for processing but beware of potentional warnings
and information
schema:
$ref: '#/definitions/Response'
'400':
description: Invoice could not be processed due to fatal errors
schema:
$ref: '#/definitions/Response'
Response:
type: object
properties:
Info:
type: string
information
Messages:
type: object
properties:
Fatal:
type: array
items:
type: object
Warning:
type: array
items:
type: object
Information:
type: array
items:
type: object
【问题讨论】: