1
我正在编写一个演示购物车API,并且遇到了可以由于多种原因返回NotFound的情况(无论是购物车项目isn找不到或者没有找到购物车本身)。我想为两种情况返回一个Swagger描述。我试过这个,但它不起作用。Swashbuckle:多个[SwaggerResponse]具有相同的状态代码但描述/模型不同
[SwaggerResponse(HttpStatusCode.NotFound, Type = typeof(CartNotFoundResponse), Description = "Cart not found (code=1)")]
[SwaggerResponse(HttpStatusCode.NotFound, Type = typeof(ItemNotFoundResponse), Description = "Item not found (code=104)")]
[SwaggerResponse(HttpStatusCode.NoContent)]
public async Task<IHttpActionResult> DeleteItemWithSKUAsync(Guid cartId, string sku)
{
}
有什么建议吗?