public class OrderTagsDocumentFilter : IDocumentFilter { public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) { swaggerDoc.Tags = swaggerDoc.Tags .OrderByDescending(x => x.Name).ToList(); } }
services.AddSwaggerGen(c =>
{
c.OrderActionsBy(x =>
{
return $"{x.ActionDescriptor.RouteValues["controller"]}_{x.HttpMethod}";
});
c.DocumentFilter<OrderTagsDocumentFilter>(); });