在C#中构建一个API层,并使用Swagger和Swashbuckle作为文档。到目前为止,我很喜欢它!只有一个问题。
默认情况下,API的分层是两个深层。示例...这些是当前可用的API,扩展了Access Integration: Integration Settings
:
我想弄清楚的是如何对Access Integration
进行单一分组,点击后会显示这些控制器:
然后您可以钻入任何一个控制器以查看其中的方法。所以,基本上,三层而不是两层。
这可能吗?我一直在看这个问题:Grouping of API methods in documentation - is there some custom attribute,但它没有让我在那里。我一直在试图弄清楚如何使用它:
c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString());
但我没有找到任何使用它的例子。
我试过这个:
[SwaggerOperation(Tags = new[] { "Access Integration", "Sync Doors" })]
和
[SwaggerOperation(Tags = new[] { "Access Integration", "Sync Users" })]
但是,这只列出了两次控制器,一次是在“Access Integration”下,另一次是在“Sync Users”下。