From 4e72d3ed739096aaed5812344068d2f668881104 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 21 Mar 2024 18:55:44 +0300 Subject: [PATCH] Fixes unnecessary new lines --- src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs | 4 ++-- src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index 6c71029cf6..1444ae03d9 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -84,14 +84,14 @@ public override string GetAccessModifier(AccessModifier access) }; } #pragma warning disable CA1822 // Method should be static - internal void AddRequestBuilderBody(CodeClass parentClass, string returnType, LanguageWriter writer, string? urlTemplateVarName = default, string? prefix = default, IEnumerable? pathParameters = default) + internal void AddRequestBuilderBody(CodeClass parentClass, string returnType, LanguageWriter writer, string? urlTemplateVarName = default, string? prefix = default, IEnumerable? pathParameters = default, bool includeIndent = true) { if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp && parentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProp) { var pathParametersSuffix = !(pathParameters?.Any() ?? false) ? string.Empty : $", {string.Join(", ", pathParameters.Select(x => $"{x.Name.ToFirstCharacterLowerCase()}"))}"; var urlTplRef = string.IsNullOrEmpty(urlTemplateVarName) ? pathParametersProp.Name.ToFirstCharacterUpperCase() : urlTemplateVarName; - writer.WriteLine($"{prefix}new {returnType}({urlTplRef}, {requestAdapterProp.Name.ToFirstCharacterUpperCase()}{pathParametersSuffix});"); + writer.WriteLine($"{prefix}new {returnType}({urlTplRef}, {requestAdapterProp.Name.ToFirstCharacterUpperCase()}{pathParametersSuffix});", includeIndent); } } public override string TempDictionaryVarName => "urlTplParams"; diff --git a/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs index d50c0bc1ff..3f00038af6 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs @@ -44,7 +44,7 @@ private void WritePropertyInternal(CodeProperty codeElement, LanguageWriter writ writer.WriteLine($"{conventions.GetAccessModifier(codeElement.Access)} {propertyType} {codeElement.Name.ToFirstCharacterUpperCase()}"); writer.StartBlock(); writer.Write("get => "); - conventions.AddRequestBuilderBody(parentClass, propertyType, writer); + conventions.AddRequestBuilderBody(parentClass, propertyType, writer, includeIndent: false); writer.CloseBlock(); break; case CodePropertyKind.AdditionalData when backingStoreProperty != null: