How does swagger block the interface that comes with it by default?

as shown in the figure below, a Swagger interface is always generated by default after swagger documents are generated. After a careful study of the configuration file, there is no option to block this interface.

this interface is useless. Putting it here will affect the outlook. How to block this interface?

May.22,2021

1. Add DocumentFilter to the SwaggerConfig.cs file

GlobalConfiguration.Configuration.EnableSwagger(c =>{
    //  DocumentFilter
    c.DocumentFilter<HiddenApiFilter>();  
})

2. Add HiddenApiFilter.cs class

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]   
public partial class HiddenApiAttribute : Attribute { }
public class HiddenApiFilter : IDocumentFilter
{
   
    public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
    {
        foreach (ApiDescription apiDescription in apiExplorer.ApiDescriptions)
        {            
            var _key = "/" + apiDescription.RelativePath.TrimEnd('/');
            //  swagger 
            if (_key.Contains("/api/Swagger") && swaggerDoc.paths.ContainsKey(_key))
                swaggerDoc.paths.Remove(_key);
        }
    }
}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e7a4fe-7c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e7a4fe-7c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?