我需要通过 C# 设置一些具有相同 http 状态代码的响应示例。
但我还是不知道。
我能怎么做 ?
请给我一些提示...
// i want to create json , like this.
responses:
'404':
description: please , let It worked...
content:
application/json:
schema:
$ref: '#/components/schemas/TestModel'
examples:
success :
summary: Example of a successful response
value:
code : 1
message : "test message 1"
success2 :
summary: Example of a successful response2
value:
code : 2
message: "test message 2"
更新:我使用 NSwag,像这样
我需要让代码 404 有两个示例响应
/// <summary></summary>
/// <remarks></remarks>
/// <response code="200"></response>
/// <response code="404">Message 1</response>
/// <response code="404">Message 2</response> // <---- error will occur ,
[HttpPost]
[ProducesResponseType(typeof(CreateIdentificationResponse), 200)]
[ProducesResponseType(typeof(ErrorResponse), 404)]
[ProducesResponseType(typeof(ErrorResponse), 404)]
public IActionResult Post(){
}