Skip to content
Documentation

SwaggerGenOptionsExtensions Class

Provides extension methods on Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions for non-trivial modification of generated OpenAPI documents.

public static class SwaggerGenOptionsExtensions

Inheritance System.Object 🡒 SwaggerGenOptionsExtensions

SwaggerGenOptionsExtensions.AddCustomModelBinderFilters<TModel>(this SwaggerGenOptions) Method

Section titled “SwaggerGenOptionsExtensions.AddCustomModelBinderFilters<TModel>(this SwaggerGenOptions) Method”

Registers Swashbuckle.AspNetCore.SwaggerGen.IOperationFilter instances that cause proper documentation of parameters bound by ICustomModelBinder implementations.

public static Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions AddCustomModelBinderFilters<TModel>(this Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions swaggerGenOptions);

TModel

The model for which a custom model binder is being used.

swaggerGenOptions Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions

The Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions used to configure the creation of the OpenAPI document.

Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions
The swaggerGenOptions for chaining of additional configuration method calls.

Whenever an implementation of ICustomModelBinder is used to bind parameters from the route or query to a complex object, the automatically generated OpenAPI specification of these parameters is likely to be wrong.

Therefore, in addition to registering the custom model binder, one should also call this method with the TModel supported by the binder. This cause operation filters to be registered that will - to the best of their ability - extract information about the models underlying paramters from the binder and document them accordingly.

© 2026 Volue.Version v0.6.38017 November 2026