From 7d543009f6745c2cd374e4a75177d639fab0583a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Aug 2024 13:40:20 -0400 Subject: [PATCH] fix: missing ts path parameters Signed-off-by: Vincent Biret --- CHANGELOG.md | 1 + src/Kiota.Builder/CodeDOM/CodeParameter.cs | 4 ++++ src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aaefb356d..0d230ecc38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed shorthand for refresh option in workspace experience. [#5240](https://github.com/microsoft/kiota/issues/5240) - Fixed missing type options in help for plugin commands. [#5230](https://github.com/microsoft/kiota/issues/5230) - Removed OpenAI plugins generation since the service does not support them anymore. +- Fixed an issue where TypeScript clients would be missing path parameters. [#5247](https://github.com/microsoft/kiota/issues/5247) - Fixed an issue where models would be missing when they had no properties and a single allOf entry. [#5014](https://github.com/microsoft/kiota/issues/5014) - Reverts modification of responses in output openApi file when generating plugins [#4945](https://github.com/microsoft/kiota/issues/4945) - Expand properties types with null type for Typescript. [#4993](https://github.com/microsoft/kiota-typescript/issues/1188) diff --git a/src/Kiota.Builder/CodeDOM/CodeParameter.cs b/src/Kiota.Builder/CodeDOM/CodeParameter.cs index c283b9221a..711eecf81c 100644 --- a/src/Kiota.Builder/CodeDOM/CodeParameter.cs +++ b/src/Kiota.Builder/CodeDOM/CodeParameter.cs @@ -79,6 +79,10 @@ public bool Optional public CodeDocumentation Documentation { get; set; } = new(); public string DefaultValue { get; set; } = string.Empty; public string SerializationName { get; set; } = string.Empty; + public string WireName + { + get => string.IsNullOrEmpty(SerializationName) ? Name : SerializationName; + } public DeprecationInformation? Deprecation { get; diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index c78bb77f6d..9a51721846 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -56,7 +56,7 @@ private void WriteNavigationMetadataConstant(CodeConstant codeElement, LanguageW { writer.StartBlock($"{navigationMethod.Name.ToFirstCharacterLowerCase()}: {{"); var requestBuilderName = navigationMethod.ReturnType.Name.ToFirstCharacterUpperCase(); - WriteNavigationMetadataEntry(parentNamespace, writer, requestBuilderName, navigationMethod.Parameters.Where(static x => x.Kind is CodeParameterKind.Path or CodeParameterKind.Custom && !string.IsNullOrEmpty(x.SerializationName)).Select(static x => $"\"{x.SerializationName}\"").ToArray()); + WriteNavigationMetadataEntry(parentNamespace, writer, requestBuilderName, navigationMethod.Parameters.Where(static x => x.Kind is CodeParameterKind.Path or CodeParameterKind.Custom).Select(static x => $"\"{x.WireName}\"").ToArray()); writer.CloseBlock("},"); } foreach (var navigationProperty in navigationProperties)