ServiceStack + Swagger以不同方式对资源进行分组的能力

时间:2013-05-25 01:25:31

标签: c# .net servicestack swagger

首先我要说ServiceStack已经超越了我作为框架的所有期望。已经取得的成就令人惊叹。

我目前正在使用带有ServiceStack的Swagger UI插件,并且想知道有没有一种方法可以将资源分开而不是现在出现?似乎分组是由根决定的。

目前的分组是这样的:

/clients
    /clients/{clientId}/locations/{id} 
    /clients/{clientId}/locations/{locationId}/reports
    /clients/{clientId}/locations/{locationId}/reports/{id}

我宁愿让swagger ui输出看起来像这样的东西:

Clients
    /clients/{id}
Locations
    /clients/{clientId}/locations
Reports
    /clients/{clientId}/locations/{locationId}/reports

如果您可以通过使用如下所示的分组来执行上述操作,那将会很酷。

[Route("/hello/{Name}", "GET", 
Summary = @"Says ""Hello"" to provided Name with GET.", 
  Notes = "Longer description of the GET method which says 'Hello'", 
  // like this!
  SwaggerGroup="Clients")]

这可能更多是对Swagger的限制,而不是对ServiceStack的限制,但我想我会问。

1 个答案:

答案 0 :(得分:1)

ServiceStack不会对Swagger UI进行任何修改。如果Swagger中不存在此功能,则它在ServiceStack中也不可用。

也就是说,Swagger UI是使用/swagger-ui folder中的静态JavaScript和HTML生成的,因此您可以修改UI并在本地副本中添加所需的任何自定义项。