-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
What are you wanting to achieve?
I have just changed the SwaggerAnnotationsEndpoints of the WebApi project and realized that the ParameterFilters are not being called when you insert the WithOpenApi extension method.
I do not know if this is by design but the change of this is pretty simple.
Previously :
Swashbuckle.AspNetCore/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs
Lines 406 to 415 in 7a7230d
| var apiParameter = apiDescription.ParameterDescriptions.SingleOrDefault(desc => desc.Name == parameter.Name && !desc.IsFromBody() && !desc.IsFromForm() && !desc.IsIllegalHeaderParameter()); | |
| if (apiParameter is not null) | |
| { | |
| parameter.Schema = GenerateSchema( | |
| apiParameter.Type, | |
| schemaRepository, | |
| apiParameter.PropertyInfo(), | |
| apiParameter.ParameterInfo(), | |
| apiParameter.RouteInfo); | |
| } |
Now (If it's not by design), I have also to integrate ParameterAsyncFilters:
var apiParameter = apiDescription.ParameterDescriptions.SingleOrDefault(desc => desc.Name == parameter.Name && !desc.IsFromBody() && !desc.IsFromForm() && !desc.IsIllegalHeaderParameter());
if (apiParameter is not null)
{
var (parameterAndContext, filterContext) = GenerateParameterAndContext(apiParameter, schemaRepository);
parameter.Schema = parameterAndContext.Schema;
foreach (var filter in _options.ParameterFilters)
{
filter.Apply(parameter, filterContext);
}
}I label this as Question because I am not sure if the WithOpenApi should apply the ParameterFilters
What code or approach do you have so far?
I want that the ParameterFilters run also when the WithOpenApi extension method is called
Additional context
No response