From f0f2d9d12d1d9b0f810457d904636488fe40e873 Mon Sep 17 00:00:00 2001 From: "g.turri" Date: Fri, 15 Mar 2024 19:28:28 +0100 Subject: [PATCH] Add an extension point after C# class definition This makes it possible to generate code that knows the name of the generated class. (the practical use case I have is adding a method that would register several instances of the generated client (each with a different authentication method) in my DI) Nb: an alternatives to this commit would be to leverage an extension point in the File.liquid, but at this point the name of the generated classes are not available --- .../Templates/Client.Class.AfterDefinition.liquid | 0 src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.AfterDefinition.liquid diff --git a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.AfterDefinition.liquid b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.AfterDefinition.liquid new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid index 584842c89f..6e260a43a6 100644 --- a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid +++ b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid @@ -474,3 +474,5 @@ {% template Client.Class.ConvertToString %} {% template Client.Class.Body %} } + +{% template Client.Class.AfterDefinition %}