NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

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

Open sconnon-repay opened this issue 8 months ago • 1 comments

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:

  • ValueFor200 => Response
  • ValueFor201 => Response1

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 avatar Jun 11 '24 14:06 sconnon-repay