更新到 Swashbuckle.AspNetCore 3.0 不再按标签分组

Update to Swashbuckle.AspNetCore 3.0 does not group by tag anymore

我在 Swagger UI 中使用 [SwaggerOperation(Tags = new[] { "GroupA" })] 将我的操作分组到一个控制器中。

更新到 3.0 后,不再考虑这一点,仅按控制器名称分组。

属性中的 "changed" 标签名称也不再生成到 Swagger JSON/YAML 中,只有控制器名称作为标签。

我无法在 release notes 中找到有关此行为的重大更改的提示。

任何关于行为改变的见解and/or我将不胜感激。

所以所有这些都在发行说明中有详细记录,您在阅读它时不应该匆忙。

我在问题中没有提到的是,我需要安装Swashbuckle.AspNetCore.Annotations才能取回[SwaggerOperation](已分离)。

现在需要通过以下方式主动启用这些:

services.AddSwaggerGen(c =>
{
   ...

   c.EnableAnnotations();
});

来自发行说明:

Updates to annotations: To continue using the swagger-specific annotations, you'll need to explicitly install and enable the new Swashbuckle.AspNetCore.Annotations package as described here.

"here" 将您准确带到描述此步骤的地方:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore#swashbuckleaspnetcoreannotations