Skip to content

Commit

Permalink
Exclude the generic pathParameters variable from being written to the…
Browse files Browse the repository at this point in the history
… output.
  • Loading branch information
koros committed Nov 18, 2024
1 parent f2f1c8e commit ec4aea7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Kiota.Builder/Writers/HTTP/CodeClassDeclarationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Web;
using Kiota.Builder.CodeDOM;
using Kiota.Builder.Extensions;

namespace Kiota.Builder.Writers.http;
public class CodeClassDeclarationWriter(HttpConventionService conventionService) : CodeProprietableBlockDeclarationWriter<ClassDeclaration>(conventionService)
Expand Down Expand Up @@ -57,10 +58,11 @@ private static void WriteUrlTemplate(CodeElement codeElement, LanguageWriter wri

private static void WritePathParameters(CodeElement codeElement, LanguageWriter writer)
{
// Retrieve all the path variables except the generic path parameter named "pathParameters"
var pathParameters = codeElement.Parent?
.GetChildElements(true)
.OfType<CodeProperty>()
.Where(property => property.IsOfKind(CodePropertyKind.PathParameters))
.Where(property => property.IsOfKind(CodePropertyKind.PathParameters) && !property.Name.Equals("pathParameters", StringComparison.OrdinalIgnoreCase))
.ToList();

pathParameters?.ForEach(prop =>
Expand Down Expand Up @@ -96,7 +98,7 @@ private static void WriteHttpParameterProperty(CodeProperty property, LanguageWr
if (!string.IsNullOrEmpty(property.Name))
{
writer.WriteLine($"# {property.Documentation.DescriptionTemplate}");
writer.WriteLine($"@{property.Name} = ");
writer.WriteLine($"@{property.Name.ToFirstCharacterLowerCase()} = ");
writer.WriteLine();
}
}
Expand Down

0 comments on commit ec4aea7

Please sign in to comment.