Skip to content

Commit

Permalink
Merge pull request #4406 from microsoft/feature/typescript/typescript…
Browse files Browse the repository at this point in the history
…-root-enum-bug

remove quotes around enum object Type
  • Loading branch information
baywet authored Mar 26, 2024
2 parents 1220257 + 493dd69 commit 9504993
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri
}
writer.WriteLine($"adapterMethodName: \"{GetSendRequestMethodName(isVoid, isStream, executorMethod.ReturnType.IsCollection, isPrimitive, isEnum)}\",");
if (isEnum)
writer.WriteLine($"enumObject: \"{executorMethod.ReturnType.Name.ToFirstCharacterUpperCase()}\",");
writer.WriteLine($"enumObject: {executorMethod.ReturnType.Name.ToFirstCharacterUpperCase()},");
else if (!isVoid)
writer.WriteLine($"responseBodyFactory: {GetTypeFactory(isVoid, isStream, executorMethod, writer)},");
var sanitizedRequestBodyContentType = executorMethod.RequestBodyContentType.SanitizeDoubleQuote();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ public void WritesRequestExecutorForEnum()
writer.Write(constant);
var result = tw.ToString();
Assert.Contains("sendEnum", result);
Assert.Contains("enumObject:", result);
Assert.Contains(EnumName.ToFirstCharacterUpperCase(), result);
Assert.Contains("enumObject: " + EnumName.ToFirstCharacterUpperCase(), result);
AssertExtensions.CurlyBracesAreClosed(result);
}
[Fact]
Expand All @@ -237,8 +236,7 @@ public void WritesRequestExecutorForEnumCollection()
writer.Write(constant);
var result = tw.ToString();
Assert.Contains("sendCollectionOfEnum", result);
Assert.Contains("enumObject:", result);
Assert.Contains(EnumName.ToFirstCharacterUpperCase(), result);
Assert.Contains("enumObject: " + EnumName.ToFirstCharacterUpperCase(), result);
AssertExtensions.CurlyBracesAreClosed(result);
}
[Fact]
Expand Down

0 comments on commit 9504993

Please sign in to comment.