Even for an empty project, we have the following pre-defined HTTP endpoints:

We may want to disable these endpoints (not only hide from swagger, but completely disable them). So, we need to provide an option for it.
I am hiding the abp endpoints on Swagger UI by adding a [ShowInSwagger] attribute to the controllers I want to see, then using this in my host module:
public class ShowInSwaggerAttributeFilter : IDocumentFilter
{
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
var filteredApis = context.ApiDescriptions.Where(a => a.CustomAttributes().Any(x =>
x.GetType() == typeof(ShowInSwaggerAttribute)));
foreach (var path in swaggerDoc.Paths.ToList())
{
if (filteredApis.All(x => ("/" + x.RelativePath) != path.Key))
swaggerDoc.Paths.Remove(path.Key);
}
}
}
How do I prevent the execution of certain methods and tell ABP to ignore them when creating endpoints (by convention)?
it is greate enhancement, recently I am looking for it .
some pre-built in apis I do not want to be exposed
Most helpful comment
I am hiding the abp endpoints on Swagger UI by adding a
[ShowInSwagger]attribute to the controllers I want to see, then using this in my host module: