我有一个Web API(WebApi 2)。我正在尝试使用Swashbuckle进行文档编制。我有一个GET方法,它将List作为参数。该方法的工作原理,但没有出现在Swashbuckle文档中。Swashbuckle不显示具有作为参数的集合的方法
[RoutePrefix("myroute")]
public class MyController : ApiController
{
[HttpGet]
[Route("{foo}/{bar}")]
public async Task<IHttpActionResult> Get([FromUri]List<string> foo, string bar)
{
return Ok();
}
}
如何获得一个List或数组来处理Swashbuckle?
UPDATE
这是我昂首阔步配置:
public class SwaggerConfig
{
public static void Register(HttpConfiguration config)
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
config
.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "ZipCodeWebApi.API");
c.IncludeXmlComments(string.Format(@"{0}\App_Data\ZipCodeWebApi.API.XML", System.AppDomain.CurrentDomain.BaseDirectory));
c.DescribeAllEnumsAsStrings();
})
.EnableSwaggerUi(c =>
{
});
}
}
直到你在你的webapi路由中做出改变,它才会显示在大摇大摆,因为这不是一个有效的路线。 –