Skip to content

Commit 12a7434

Browse files
b-shep-ascentraman-m
authored andcommitted
Added annotations to cause ApiExplorer to ignore outputcache and fileconfiguration endpoints thus preventing them from registering with Swagger
1 parent bc25f4e commit 12a7434

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed
+25-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
using Microsoft.AspNetCore.Authorization;
2-
using Microsoft.AspNetCore.Mvc;
3-
4-
namespace Ocelot.Cache
5-
{
6-
[Authorize]
7-
[Route("outputcache")]
8-
public class OutputCacheController : Controller
9-
{
10-
private readonly IOcelotCache<CachedResponse> _cache;
11-
12-
public OutputCacheController(IOcelotCache<CachedResponse> cache)
13-
{
14-
_cache = cache;
15-
}
16-
17-
[HttpDelete]
18-
[Route("{region}")]
19-
public IActionResult Delete(string region)
20-
{
21-
_cache.ClearRegion(region);
22-
return new NoContentResult();
23-
}
24-
}
1+
using Microsoft.AspNetCore.Authorization;
2+
using Microsoft.AspNetCore.Mvc;
3+
4+
namespace Ocelot.Cache
5+
{
6+
[Authorize]
7+
[Route("outputcache")]
8+
[ApiExplorerSettings(IgnoreApi=true)]
9+
public class OutputCacheController : Controller
10+
{
11+
private readonly IOcelotCache<CachedResponse> _cache;
12+
13+
public OutputCacheController(IOcelotCache<CachedResponse> cache)
14+
{
15+
_cache = cache;
16+
}
17+
18+
[HttpDelete]
19+
[Route("{region}")]
20+
public IActionResult Delete(string region)
21+
{
22+
_cache.ClearRegion(region);
23+
return new NoContentResult();
24+
}
25+
}
2526
}

src/Ocelot/Configuration/FileConfigurationController.cs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace Ocelot.Configuration
1313

1414
[Authorize]
1515
[Route("configuration")]
16+
[ApiExplorerSettings(IgnoreApi=true)]
1617
public class FileConfigurationController : Controller
1718
{
1819
private readonly IFileConfigurationRepository _repo;

0 commit comments

Comments
 (0)