Skip to content

Commit d0cf8b2

Browse files
API: filter controller namespace
1 parent 7d6714b commit d0cf8b2

File tree

1 file changed

+11
-0
lines changed
  • src/Certify.Server/Certify.Server.HubService

1 file changed

+11
-0
lines changed

src/Certify.Server/Certify.Server.HubService/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Microsoft.OpenApi.Models;
2020
using Scalar.AspNetCore;
2121
using Serilog;
22+
using Swashbuckle.AspNetCore.SwaggerGen;
2223

2324
List<ActionStep> _systemStatusItems = [];
2425
void AddSystemStatusItem(string systemStatusCategory, string systemStatusKey, string title, string description, bool hasError = false, bool hasWarning = false) => _systemStatusItems.Add(new ActionStep(systemStatusKey, systemStatusCategory, title, description, hasError, hasWarning));
@@ -114,6 +115,16 @@
114115

115116
c.UseAllOfToExtendReferenceSchemas();
116117

118+
c.DocInclusionPredicate((docName, apiDesc) =>
119+
{
120+
if (!apiDesc.TryGetMethodInfo(out MethodInfo methodInfo))
121+
{
122+
return false;
123+
}
124+
125+
return methodInfo.DeclaringType.Namespace.StartsWith("Certify.Server.Hub.Api.Controllers");
126+
});
127+
117128
// use the actual method names as the generated operation id
118129
c.CustomOperationIds(e =>
119130
$"{e.ActionDescriptor.RouteValues["action"]}"

0 commit comments

Comments
 (0)