Home:ALL Converter>Add textual sections to Swagger using Swashbuckle

Add textual sections to Swagger using Swashbuckle

Ask Time:2019-01-22T17:31:37         Author:Jeroen

Json Formatter

I'm using Swashbuckle with Redoc to document my ASP.NET Core 2.2 API. The live ReDoc demo has a set of sections at the top (e.g. "Introduction") with some custom html. I want to generate similar sections in my API but can't see how to do so.

Basically I have:

services.AddSwaggerGen(c => {
    c.SwaggerDoc(...);
    c.IncludeXmlComments(...);
    c.AddSecurityDefinition("OAuth2", ...);
});

And later:

app.UseReDoc(c => {
    c.SpecUrl = "/swagger/v1/swagger.json";
    c.RoutePrefix = "";
});

I've ran through the intellisense options, as well as the Swashbuckle readme and wiki, but found no way to generate such sections.

What's the way to add HTML sections to the start of Swashbuckle.AspNetCore.ReDoc based documentation?

Author:Jeroen,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/54305129/add-textual-sections-to-swagger-using-swashbuckle
yy