Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rkodev committed Oct 7, 2024
1 parent b46ce78 commit 8b7c090
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void WriteComposedTypeDeserializer(CodeFunction codeElement, LanguageWri
if (composedType.Types.Any(x => IsPrimitiveType(x, composedType, false)))
{
var expression = string.Join(" ?? ", composedType.Types.Where(x => IsPrimitiveType(x, composedType, false)).Select(codeType => $"n.{conventions.GetDeserializationMethodName(codeType, codeElement.OriginalLocalMethod, composedType.IsCollection)}"));
writer.WriteLine($"\"\": n => {{ {composedParam.Name.ToFirstCharacterLowerCase()} = {expression}}},");
writer.WriteLine($"\"\" : n => {{ {composedParam.Name.ToFirstCharacterLowerCase()} = {expression}}},");
}
foreach (var mappedType in composedType.Types.Where(x => !IsPrimitiveType(x, composedType, false)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1252,9 +1252,9 @@ public async Task Writes_UnionOfPrimitiveValues_SerializerFunctionAsync()
writer.Write(serializerFunction);
var serializerFunctionStr = tw.ToString();
Assert.Contains("return", serializerFunctionStr);
Assert.Contains("switch", serializerFunctionStr);
Assert.Contains("case \"number\":", serializerFunctionStr);
Assert.Contains("case \"string\":", serializerFunctionStr);
Assert.Contains("switch (true)", serializerFunctionStr);
Assert.Contains("case typeof primitives === \"number\":", serializerFunctionStr);
Assert.Contains("case typeof primitives === \"string\":", serializerFunctionStr);
Assert.Contains("break", serializerFunctionStr);
AssertExtensions.CurlyBracesAreClosed(serializerFunctionStr, 1);
}
Expand Down

0 comments on commit 8b7c090

Please sign in to comment.