Skip to content

Commit

Permalink
Avoid triple enumeration of Form Parameters (#2823)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 23, 2024
1 parent a17b464 commit 00d4483
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ private IList<OpenApiParameter> GenerateParameters(ApiDescription apiDescription
.FirstOrDefault(paramDesc => paramDesc.IsFromBody());

var formParameters = apiDescription.ParameterDescriptions
.Where(paramDesc => paramDesc.IsFromForm());
.Where(paramDesc => paramDesc.IsFromForm())
.ToList();

if (bodyParameter != null)
{
Expand All @@ -418,7 +419,7 @@ private IList<OpenApiParameter> GenerateParameters(ApiDescription apiDescription
schemaGenerator: _schemaGenerator,
schemaRepository: schemaRepository);
}
else if (formParameters.Any())
else if (formParameters.Count > 0)
{
requestBody = GenerateRequestBodyFromFormParameters(apiDescription, schemaRepository, formParameters);

Expand Down

0 comments on commit 00d4483

Please sign in to comment.