Skip to content

Commit 3c27f55

Browse files
author
Remco Lam
committed
sdfs
1 parent 438158a commit 3c27f55

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Swashbuckle.AspNetCore.SwaggerGen/DependencyInjection/SwaggerGenOptionsExtensions.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,23 @@ public static void SchemaFilter<TFilter>(
343343
});
344344
}
345345

346+
/// <summary>
347+
/// Extend the Swagger Generator with "filters" that can modify Schemas after they're initially generated
348+
/// </summary>
349+
/// <typeparam name="TFilter">A type that derives from IDocumentFilter</typeparam>
350+
/// <param name="swaggerGenOptions"></param>
351+
/// <param name="filterInstance">An instance of the filter, to enable reuse.</param>
352+
public static void AddSchemaFilterInstance<TFilter>(
353+
this SwaggerGenOptions swaggerGenOptions,
354+
TFilter filterInstance)
355+
where TFilter : IDocumentFilter
356+
{
357+
swaggerGenOptions.DocumentFilterDescriptors.Add(new FilterDescriptor
358+
{
359+
FilterInstance = filterInstance
360+
});
361+
}
362+
346363
/// <summary>
347364
/// Extend the Swagger Generator with "filters" that can modify Parameters after they're initially generated
348365
/// </summary>
@@ -361,6 +378,8 @@ public static void ParameterFilter<TFilter>(
361378
});
362379
}
363380

381+
xxxxxx
382+
364383
/// <summary>
365384
/// Extend the Swagger Generator with "filters" that can modify RequestBodys after they're initially generated
366385
/// </summary>
@@ -379,6 +398,8 @@ public static void RequestBodyFilter<TFilter>(
379398
});
380399
}
381400

401+
xxxxxx
402+
382403
/// <summary>
383404
/// Extend the Swagger Generator with "filters" that can modify Operations after they're initially generated
384405
/// </summary>

0 commit comments

Comments
 (0)