ASP.NET Web Api Swagger IEnumerable

时间:2018-08-01 07:54:22

标签: api web swagger swashbuckle

为什么显示不正确?我使用了Swashbuckle v5.6.0。在Swagger UI中,我得到一个像这样的模型:

Inline Model [
    Inline Model 1
]
Inline Model 1 {
    ID (integer, optional),
    WordingFR (string, optional),
    WordingNL (string, optional)
}

对于像这样的REST Get方法:

[HttpGet]
    [Route("GetCivilStatus")] // this route becomes [controller]/GetCivilStatus 

    [SwaggerResponse(HttpStatusCode.OK, Type = typeof(IEnumerable<CivilStatus>))]
    public List<CivilStatus> GetCivilStatus()
        {...}

0 个答案:

没有答案