问题
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