向API文档添加第三层

问题描述 投票:2回答:1

在C#中构建一个API层,并使用Swagger和Swashbuckle作为文档。到目前为止,我很喜欢它!只有一个问题。

默认情况下,API的分层是两个深层。示例...这些是当前可用的API,扩展了Access Integration: Integration Settings

enter image description here

我想弄清楚的是如何对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”下。

c# .net swagger swashbuckle
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.