How to generate multiple pages from Swashbuckle.AspNet?

穿精又带淫゛_ 提交于 2019-12-11 23:24:18

问题


I've been following this guide to create developer friendly documentation for my ASP.Net REST WebApi using Swashbuckle. However, the current version Swashbuckle.AspNetCore v2.2.0 generates a huge single page app, which is confusing for my users. If I remember correctly, Swashbuckle was generating separate pages for each controller/method (early 2017?). My configuration looks like this:

app.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "API V1");
    c.EnableFilter();
    c.MaxDisplayedTags(5);
});

Q: Is there any way to make Swagger-UI generate separate pages for each controller and method instead of a huge single scrolling mess?

Some more Details:

  • VS2017
  • Microsoft.AspNetCore 2.0.0
  • Microsoft.AspNetCore.Mvc 2.0.0
  • Swashbuckle.AspNetCore 2.2.0
  • Pure WebApi - only JSON is generated, no HTML at all.
  • Self Hosting via Kestrel on
    • either Windows using net 4.6.2 (here Swashbuckle is used)
    • or embedded Linux using dotnet core 2.0 (Swashbuckle disabled)

回答1:


Swashbuckle.AspNetCore v2.2.0 has support of arbitrary grouping of API actions into multiple Swagger documents.

Please refer the documentation here: https://github.com/domaindrivendev/Swashbuckle.AspNetCore#generate-multiple-swagger-documents



来源:https://stackoverflow.com/questions/49128689/how-to-generate-multiple-pages-from-swashbuckle-aspnet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!