Skip to content

Commit

Permalink
Display all conflicting actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Saibamen committed Nov 26, 2024
1 parent eee5e12 commit e784eb0
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,12 @@ private List<Tuple<OpenApiOperationDescription, ApiDescription, MethodInfo>> Add

if (pathItem.ContainsKey(operation.Method))
{
var conflictingApiDescription = addedOperations
.First(t => t.Item1.Path == operation.Path && t.Item1.Method == operation.Method)
.Item2;
var conflictingApiDescriptions = operations
.Where(t => t.Item1.Path == operation.Path && t.Item1.Method == operation.Method)
.Select(t => t.Item2)
.ToList();

throw new InvalidOperationException($"The method '{operation.Method}' on path '{path}' is registered multiple times for actions {conflictingApiDescription.ActionDescriptor.DisplayName} and {apiDescription.ActionDescriptor.DisplayName}.");
throw new InvalidOperationException($"The method '{operation.Method}' on path '{path}' is registered multiple times for actions {string.Join(", ", conflictingApiDescriptions.Select(apiDesc => apiDesc.ActionDescriptor.DisplayName))}.");
}

pathItem[operation.Method] = operation.Operation;
Expand Down

0 comments on commit e784eb0

Please sign in to comment.