From 6dcf7a5e9f0f13c9f620060ca945747189aeeeec Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Tue, 26 Nov 2024 11:14:05 +0100 Subject: [PATCH] Add space between duplicated actions in error message (#3177) --- .../SwaggerGenerator/SwaggerGenerator.cs | 2 +- .../SwaggerGenerator/SwaggerGeneratorTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs b/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs index d4c692154c..d50ece3038 100644 --- a/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs +++ b/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs @@ -287,7 +287,7 @@ private async Task> GenerateOperatio "Actions require a unique method/path combination for Swagger/OpenAPI 2.0 and 3.0. Use ConflictingActionsResolver as a workaround or provide your own implementation of PathGroupSelector.", httpMethod, group.First().RelativePath, - string.Join(",", group.Select(apiDesc => apiDesc.ActionDescriptor.DisplayName)))); + string.Join(", ", group.Select(apiDesc => apiDesc.ActionDescriptor.DisplayName)))); } var apiDescription = (count > 1) ? _options.ConflictingActionsResolver(group) : group.Single(); diff --git a/test/Swashbuckle.AspNetCore.SwaggerGen.Test/SwaggerGenerator/SwaggerGeneratorTests.cs b/test/Swashbuckle.AspNetCore.SwaggerGen.Test/SwaggerGenerator/SwaggerGeneratorTests.cs index c7e63e3d20..15acdb9637 100644 --- a/test/Swashbuckle.AspNetCore.SwaggerGen.Test/SwaggerGenerator/SwaggerGeneratorTests.cs +++ b/test/Swashbuckle.AspNetCore.SwaggerGen.Test/SwaggerGenerator/SwaggerGeneratorTests.cs @@ -1137,7 +1137,7 @@ public void GetSwagger_ThrowsSwaggerGeneratorException_IfActionsHaveConflictingH var exception = Assert.Throws(() => subject.GetSwagger("v1")); Assert.Equal( "Conflicting method/path combination \"POST resource\" for actions - " + - "Swashbuckle.AspNetCore.SwaggerGen.Test.FakeController.ActionWithNoParameters (Swashbuckle.AspNetCore.SwaggerGen.Test)," + + "Swashbuckle.AspNetCore.SwaggerGen.Test.FakeController.ActionWithNoParameters (Swashbuckle.AspNetCore.SwaggerGen.Test), " + "Swashbuckle.AspNetCore.SwaggerGen.Test.FakeController.ActionWithNoParameters (Swashbuckle.AspNetCore.SwaggerGen.Test). " + "Actions require a unique method/path combination for Swagger/OpenAPI 2.0 and 3.0. Use ConflictingActionsResolver as a workaround or provide your own implementation of PathGroupSelector.", exception.Message); @@ -1167,7 +1167,7 @@ public void GetSwagger_ThrowsSwaggerGeneratorException_IfActionsHaveConflictingH var exception = Assert.Throws(() => subject.GetSwagger("v1")); Assert.Equal( "Conflicting method/path combination \"GET resource\" for actions - " + - "Swashbuckle.AspNetCore.SwaggerGen.Test.FakeController.ActionWithNoParameters (Swashbuckle.AspNetCore.SwaggerGen.Test)," + + "Swashbuckle.AspNetCore.SwaggerGen.Test.FakeController.ActionWithNoParameters (Swashbuckle.AspNetCore.SwaggerGen.Test), " + "Swashbuckle.AspNetCore.SwaggerGen.Test.FakeController.ActionWithIntFromQueryParameter (Swashbuckle.AspNetCore.SwaggerGen.Test). " + "Actions require a unique method/path combination for Swagger/OpenAPI 2.0 and 3.0. Use ConflictingActionsResolver as a workaround or provide your own implementation of PathGroupSelector.", exception.Message);