From 0f0b9dccf7a9dceabfcf92f6fd9b6df3b55aa36d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 19 Apr 2024 09:51:33 -0400 Subject: [PATCH] - fixes casing issue in deserialization of response content in TypeScript Signed-off-by: Vincent Biret --- CHANGELOG.md | 5 +++-- src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc3658e93..6f008adb45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Fixed a bug where TypeScript deserialization would fail on Uppercase properties.[#4479](https://github.com/microsoft/kiota/issues/4479) - Changed URI template generation to reuse templates when required templates are absent across operations. -- Updated reserved name providers for Java and Php so that "object" can be escaped. -- Do not generate CS8603 warnings when enabling backing store in CSharp generation. +- Updated reserved name providers for Java and Php so that "object" can be escaped. +- Do not generate CS8603 warnings when enabling backing store in CSharp generation. ## [1.13.0] - 2024-04-04 diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs index 0e54393520..d316d72f83 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs @@ -236,14 +236,13 @@ private void WriteDeserializerFunction(CodeFunction codeFunction, LanguageWriter foreach (var otherProp in properties) { - var keyName = !string.IsNullOrWhiteSpace(otherProp.SerializationName) ? otherProp.SerializationName.ToFirstCharacterLowerCase() : otherProp.Name.ToFirstCharacterLowerCase(); var suffix = otherProp.Name.Equals(primaryErrorMappingKey, StringComparison.Ordinal) ? primaryErrorMapping : string.Empty; - if (keyName.Equals(BackingStoreEnabledKey, StringComparison.Ordinal)) - writer.WriteLine($"\"{keyName}\": n => {{ {param.Name.ToFirstCharacterLowerCase()}.{otherProp.Name.ToFirstCharacterLowerCase()} = true;{suffix} }},"); + if (otherProp.Kind is CodePropertyKind.BackingStore) + writer.WriteLine($"\"{BackingStoreEnabledKey}\": n => {{ {param.Name.ToFirstCharacterLowerCase()}.{otherProp.Name.ToFirstCharacterLowerCase()} = true;{suffix} }},"); else { var defaultValueSuffix = GetDefaultValueLiteralForProperty(otherProp) is string dft && !string.IsNullOrEmpty(dft) ? $" ?? {dft}" : string.Empty; - writer.WriteLine($"\"{keyName}\": n => {{ {param.Name.ToFirstCharacterLowerCase()}.{otherProp.Name.ToFirstCharacterLowerCase()} = n.{GetDeserializationMethodName(otherProp.Type, codeFunction)}{defaultValueSuffix};{suffix} }},"); + writer.WriteLine($"\"{otherProp.WireName}\": n => {{ {param.Name.ToFirstCharacterLowerCase()}.{otherProp.Name.ToFirstCharacterLowerCase()} = n.{GetDeserializationMethodName(otherProp.Type, codeFunction)}{defaultValueSuffix};{suffix} }},"); } }