Skip to content

Commit

Permalink
Fixes unnecessary new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Omondi committed Mar 21, 2024
1 parent 0ba86dc commit 4e72d3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CodeParameter>? pathParameters = default)
internal void AddRequestBuilderBody(CodeClass parentClass, string returnType, LanguageWriter writer, string? urlTemplateVarName = default, string? prefix = default, IEnumerable<CodeParameter>? 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";
Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4e72d3e

Please sign in to comment.