You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specify the new Custom DocumentFilter in the SwaggerConfig (e.g. c.DocumentFilter<CustomSwaggerFilter>();)
EXPECTED RESULT:
Filters to be applied based on the routes specified within IDocumentFilter's Apply method.
ACTUAL RESULT:
Filtering is not being applied. Apply method never appears to be hit when setting a breakpoint and debugging locally.
ADDITIONAL DETAILS
The below code shows the current implementation in our project. Is there any reason the following would not work? When setting a breakpoint in the Apply( ) method, it never gets hit during the startup of the application. Any help would be greatly appreciated, thanks.
Custom filter class:
namespace SwaggerFilter.Filters
{
public class CustomSwaggerFilter : IDocumentFilter
{
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
var mvcRoutesToRemove = swaggerDoc.Paths
.Where(x => x.Key.ToLower().Contains("foo.bar"))
.ToList();
mvcRoutesToRemove.ForEach(x => { swaggerDoc.Paths.Remove(x.Key); });
}
}
}
VERSION:
6.2.3
STEPS TO REPRODUCE:
c.DocumentFilter<CustomSwaggerFilter>();
)EXPECTED RESULT:
Filters to be applied based on the routes specified within IDocumentFilter's Apply method.
ACTUAL RESULT:
Filtering is not being applied. Apply method never appears to be hit when setting a breakpoint and debugging locally.
ADDITIONAL DETAILS
The below code shows the current implementation in our project. Is there any reason the following would not work? When setting a breakpoint in the Apply( ) method, it never gets hit during the startup of the application. Any help would be greatly appreciated, thanks.
Custom filter class:
Swagger setup:
The text was updated successfully, but these errors were encountered: