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

[BUG] [CSHARP] When using word Channel as part of assembly name generator produces code which could not compile

Open McMlok opened this issue 2 years ago • 0 comments

Description

When I generate API with csharp generator and use word Channel in packageName with library = generichost code is generated but is unable to compile. Problem is in RateLimitProvider where on line 42 is error "The type or namespace name 'CreateBounded' does not exist in the namespace 'Test.Channel' (are you missing an assembly reference?)"

openapi-generator version

I'm using version openapi-codegen-cli-7.8.0.jar

OpenAPI declaration file content or url

https://gist.github.com/McMlok/a3d8a858af888479cbbe406056042a3a

Generation Details

java.exe -jar .\openapi-generator-cli.jar generate -i '.\channel-repro.yaml' -g csharp -o .\test\ --additional-properties='library=generichost,targetFramework=net8.0,excludeTests=true,nullableReferenceTypes=true,useOneOfDiscriminatorLookup=true,packageName=Test.Channel.Client'

Steps to reproduce

Run generator

java.exe -jar .\openapi-generator-cli.jar generate -i '.\channel-repro.yaml' -g csharp -o .\test\ --additional-properties='library=generichost,targetFramework=net8.0,excludeTests=true,nullableReferenceTypes=true,useOneOfDiscriminatorLookup=true,packageName=Test.Channel.Client'
Suggest a fix

Add on line 42 before Channel System.Threading.Channels. or add word 'Channel' to reserved

McMlok avatar Sep 26 '24 07:09 McMlok