【发布时间】:2017-12-24 05:54:53
【问题描述】:
Swashbuckle 不会生成带有“UserCreateResponse”输出的 swagger.json,你如何解决这个问题?
[HttpPost]
public async Task<IActionResult> Update([FromBody]UserCreate Request)
{
UserCreateResponse response = new UserCreateResponse();
//do something here
// returns UserCreateResponse with http status code 200
return Ok(response);
}
你不能这样做,因为它不会返回 http 状态码,200,400,401 等
[HttpPost]
public async Task<UserCreateResponse> Update([FromBody]UserCreate Request)
{
UserCreateResponse response = new UserCreateResponse();
//do something here
// returns UserCreateResponse
return response;
}
【问题讨论】:
标签: c# rest asp.net-core swagger swashbuckle