-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide FileConfiguration and OutputCache controller from Swagger #989
Comments
Implement custom API Explorer like so:
Then replace the instance of IApiExplorer class in DI container with the custom one:
|
Thanks @darcon77, For now I've solved it in this way internal class HideOcelotControllersFilter : IDocumentFilter
{
private static readonly string[] _ignoredPaths = {
"/configuration",
"/outputcache/{region}"
};
public void Apply(SwaggerDocument swaggerDoc, DocumentFilterContext context)
{
foreach(var ignorePath in _ignoredPaths)
{
swaggerDoc.Paths.Remove(ignorePath);
}
}
} then services.AddSwaggerGen(cfg =>
{
cfg.DocumentFilter<HideOcelotControllersFilter>();
}); it's tricky, I'm looking for another way |
I think this shouldn't be closed. Both solutions above work but are not ideal. In essence, unless necessary I think Ocelot should hide these controllers from being "discovered" by things like Swashbuckle. I didn't have time to look into the code, but just adding |
Should be fixed as a part of ##1429 |
Expected Behavior / New Feature
I do not need to display FileConfigurationController and OutputCacheController in my swagger of API Geteway.
Actual Behavior / Motivation for New Feature
Steps to Reproduce the Problem
How to hide/remove them?
The text was updated successfully, but these errors were encountered: