2017-06-20 84 views
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) 
    { 
    } 

有什麼建議嗎?

回答

相關問題