RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.61k stars 1.22k forks source link

C# client response class names are not matching the titles as specified in the openapi doc #4912

Open sconnon-repay opened 3 weeks ago

sconnon-repay commented 3 weeks ago

NSwag version: command line tools v14.0.7, dotnet6 (also present on older versions) Operation: generate C# client Issue: response class names are not matching the titles as specified in the openapi doc

Hi, I am running the command line tools to generate a C# client. I am just using a default .nswag file as generated by NSwag studio The endpoint I am targeting has 2 success responses for 200 and 201 http response codes If I run this on an openapi doc where the endpoint has more than 1 success schema, then the name of the output classes get renamed:

Note: If I remove one of the success responses from the openapi doc, then the remaining class name is preserved

The command I am running is: dotnet .\path\to\dotnet-nswag.dll run .\path\to\nswag.nswag.json

I have attached the openapi doc and nswag config

nswag.nswag.json rest-spec.json

sconnon-repay commented 3 weeks ago

I have a fix for this. I can't figure out what the contributing guidelines are.

Let me know if you want me to push somewhere