openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG] Looks like a copy paste bug "`1.cs" in file "CSharpNetCoreClientCodegen.java"

Open ikill69 opened this issue 3 years ago • 2 comments

Bug Report Checklist

  • [ ] Have you provided a full/minimal spec to reproduce the issue?
  • [ ] Have you validated the input using an OpenAPI validator (example)?
  • [ ] Have you tested with the latest master to confirm the issue still exists?
  • [ ] Have you searched for related issues/PRs?
  • [ ] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When I executed the Net Core generator with the Library flag set to "generichost", I noticed several of my file names had "`1.cs" on the end.

I did a search of the repo and it looks like it may be a copy past bug. "`1.cs")%3B)

image

openapi-generator version

docker pull openapitools/openapi-generator-cli:v6.1.0

Steps to reproduce

docker run --rm -v C:\Dev\OpenAPI_CodeGen:/local openapitools/openapi-generator-cli:v6.1.0 generate -i /local/My_swagger.json -g csharp-netcore -o /local/csharp/OpenApi --skip-validate-spec --additional-properties=netCoreProjectFile=true,targetFramework=net6.0,packageName=MyClient.SDK --library=generichost

Suggest a fix

Remove the "`1" from the affected strings and mustache file names.

ikill69 avatar Sep 20 '22 23:09 ikill69

thanks for reporting the issue

cc @devhl-labs

wing328 avatar Sep 21 '22 02:09 wing328

This is intentional. In C#, a class gets it's own file. That means a generic class must have some different file name than it's non-generic counterpart. We use `x where x is the number of generic parameters. This is what Microsoft used to do, but looks like they're now using underscores instead of the grave accent.

devhl-labs avatar Sep 21 '22 02:09 devhl-labs

Thanks for the Info @devhl-labs

ikill69 avatar Sep 23 '22 05:09 ikill69