Repository: microsoft/kiota (csharp)

Issue:
Enums in Go should not be escaped.
Enum options in Go need not be escaped by appending the `escaped` string as they won't cause compilation issues due to the enum suffix as well as the uppercasing. As this change will probably break clients this should be addressed in the next breaking change

https://github.com/microsoftgraph/msgraph-sdk-go/blob/84a68c5f1b78925257f7624d38e4311e134865ad/models/browser_site_merge_type.go#L12

Pull request description:
Fixes https://github.com/microsoft/kiota/issues/2877

Enum options and enum names should not be escaped in Go

N.B. This is a breaking change

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 41a8002bbd..c6a3a5b982 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Changed
 - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936)
+- Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877)
 
 ## [1.11.1] - 2024-02-05
 
diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs
index 71e2df6164..c6b2a501f6 100644
--- a/src/Kiota.Builder/Refiners/GoRefiner.cs
+++ b/src/Kiota.Builder/Refiners/GoRefiner.cs
@@ -93,10 +93,11 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance
                 generatedCode,
                 new GoReservedNamesProvider(),
                 x => $"{x}Escaped",
-                shouldReplaceCallback: x => x is not CodeProperty currentProp ||
+                shouldReplaceCallback: x => (x is not CodeEnumOption && x is not CodeEnum) && // enums and enum options start with uppercase
+                                            (x is not CodeProperty currentProp ||
                                             !(currentProp.Parent is CodeClass parentClass &&
                                             parentClass.IsOfKind(CodeClassKind.QueryParameters, CodeClassKind.ParameterSet) &&
-                                            currentProp.Access == AccessModifier.Public)); // Go reserved keywords are all lowercase and public properties are uppercased when we don't provide accessors (models)
+                                            currentProp.Access == AccessModifier.Public))); // Go reserved keywords are all lowercase and public properties are uppercased when we don't provide accessors (models)
             ReplaceReservedExceptionPropertyNames(generatedCode, new GoExceptionsReservedNamesProvider(), x => $"{x}Escaped");
             cancellationToken.ThrowIfCancellationRequested();
             AddPropertiesAndMethodTypesImports(


Test patch:
diff --git a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs
index f5d0297b00..49c0e45252 100644
--- a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs
+++ b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs
@@ -48,7 +48,9 @@ public async Task AddsInnerClasses()
         await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Go }, root);
         Assert.Equal(2, requestBuilder.GetChildElements(true).Count());
     }
-    [Theory(Skip = "Fixing this test is a breaking change - https://github.com/microsoft/kiota/issues/2877")]
+
+
+    [Theory]
     [InlineData("break")]
     [InlineData("case")]
     public async Task EnumWithReservedName_IsNotRenamed(string input)