Skip to content

Commit

Permalink
Ensure unique parameters are added
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinesunday committed Sep 27, 2024
1 parent f7f184d commit c2d3f99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Microsoft.OpenApi/Services/OpenApiFilterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public static OpenApiDocument CreateFilteredDocument(OpenApiDocument source, Fun
{
foreach (var parameter in result.Parameters)
{
pathItem.Parameters.Add(parameter);
if (!pathItem.Parameters.Contains(parameter))
{
pathItem.Parameters.Add(parameter);
}
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Where Note

This foreach loop
implicitly filters its target sequence
- consider filtering the sequence explicitly using '.Where(...)'.
}
}
Expand Down

0 comments on commit c2d3f99

Please sign in to comment.