How can I specify https schema in the .NET Core version of Swashbuckle? In ASP.NET version I could do
.EnableSwagger(c =>
{
  c.Schemes(new[] { "https" });
}
but I don't see anything similar as part of AddSwaggerGen.
Just implement the interface IDocumentFilter and use it in Startup.cs:
public class TestFilter : IDocumentFilter
{
    public void Apply(SwaggerDocument swaggerDoc, DocumentFilterContext context)
    {
        swaggerDoc.Schemes = new string[] { "http" };
    }
}
// Startup.cs
services.AddSwaggerGen(c =>
{
     c.SwaggerDoc("v2", new Swashbuckle.AspNetCore.Swagger.Info 
                        { Title = "My API", Version = "v2" });
     c.DocumentFilter<TestFilter>();
 });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With