From 61540df00ec51182f30387094703254827b767d7 Mon Sep 17 00:00:00 2001 From: reginaldalfret Date: Fri, 9 Oct 2026 17:11:30 +0530 Subject: [PATCH] fix(annotations): format generic arguments with curly braces in doc cref Signed-off-by: reginaldalfret --- .../Templates/LambdaFunctionTemplateCode.cs | 14 ++++++++++++-- .../ComplexCalculator_Subtract_Generated.g.cs | 2 +- .../GreeterExecutable_SayHelloAsync_Generated.g.cs | 2 +- .../GreeterExecutable_SayHello_Generated.g.cs | 2 +- .../Snapshots/Greeter_SayHelloAsync_Generated.g.cs | 2 +- .../Snapshots/Greeter_SayHello_Generated.g.cs | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Templates/LambdaFunctionTemplateCode.cs b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Templates/LambdaFunctionTemplateCode.cs index 432018d02..492efa890 100644 --- a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Templates/LambdaFunctionTemplateCode.cs +++ b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Templates/LambdaFunctionTemplateCode.cs @@ -24,7 +24,7 @@ private List GetClassDocumentation() return new List { "/// ", - $"/// The generated Lambda function handler for .", + $"/// The generated Lambda function handler for .", "/// " }; } @@ -39,7 +39,7 @@ private List GetMethodDocumentation() }; if (lambdaMethod.Parameters.Any()) { - docStringlines.Add($"/// The generated Lambda function handler for p.Type.FullName))})\"/>"); + docStringlines.Add($"/// The generated Lambda function handler for FormatCrefType(p.Type.FullName)))})\"/>"); } else { @@ -56,5 +56,15 @@ private List GetMethodDocumentation() return docStringlines; } + + private static string FormatCrefType(string typeName) + { + if (string.IsNullOrEmpty(typeName)) + { + return typeName; + } + + return typeName.Replace('<', '{').Replace('>', '}'); + } } } \ No newline at end of file diff --git a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ComplexCalculator_Subtract_Generated.g.cs b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ComplexCalculator_Subtract_Generated.g.cs index d57f28af8..0222d90fd 100644 --- a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ComplexCalculator_Subtract_Generated.g.cs +++ b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ComplexCalculator_Subtract_Generated.g.cs @@ -31,7 +31,7 @@ public ComplexCalculator_Subtract_Generated() } /// - /// The generated Lambda function handler for + /// The generated Lambda function handler for /// /// The API Gateway request object that will be processed by the Lambda function handler. /// The ILambdaContext that provides methods for logging and describing the Lambda environment. diff --git a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHelloAsync_Generated.g.cs b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHelloAsync_Generated.g.cs index d4a9d4f89..380301b9b 100644 --- a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHelloAsync_Generated.g.cs +++ b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHelloAsync_Generated.g.cs @@ -43,7 +43,7 @@ public Greeter_SayHelloAsync_Generated() } /// - /// The generated Lambda function handler for + /// The generated Lambda function handler for /// /// The API Gateway request object that will be processed by the Lambda function handler. /// The ILambdaContext that provides methods for logging and describing the Lambda environment. diff --git a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHello_Generated.g.cs b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHello_Generated.g.cs index ae7a7b4e3..abaaa043d 100644 --- a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHello_Generated.g.cs +++ b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/GreeterExecutable_SayHello_Generated.g.cs @@ -43,7 +43,7 @@ public Greeter_SayHello_Generated() } /// - /// The generated Lambda function handler for + /// The generated Lambda function handler for /// /// The API Gateway request object that will be processed by the Lambda function handler. /// The ILambdaContext that provides methods for logging and describing the Lambda environment. diff --git a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHelloAsync_Generated.g.cs b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHelloAsync_Generated.g.cs index fef0cad2e..5b3f2a5c2 100644 --- a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHelloAsync_Generated.g.cs +++ b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHelloAsync_Generated.g.cs @@ -31,7 +31,7 @@ public Greeter_SayHelloAsync_Generated() } /// - /// The generated Lambda function handler for + /// The generated Lambda function handler for /// /// The API Gateway request object that will be processed by the Lambda function handler. /// The ILambdaContext that provides methods for logging and describing the Lambda environment. diff --git a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHello_Generated.g.cs b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHello_Generated.g.cs index 6cca2d1c5..e43afb06d 100644 --- a/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHello_Generated.g.cs +++ b/Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/Greeter_SayHello_Generated.g.cs @@ -31,7 +31,7 @@ public Greeter_SayHello_Generated() } /// - /// The generated Lambda function handler for + /// The generated Lambda function handler for /// /// The API Gateway request object that will be processed by the Lambda function handler. /// The ILambdaContext that provides methods for logging and describing the Lambda environment.