cancel
Showing results for 
Search instead for 
Did you mean: 

ApiClient ApiException Configuration namespaces do not match to packageName option

New Contributor

ApiClient ApiException Configuration namespaces do not match to packageName option

Dears

 

I'm trying to generate csharp client form petstore json OpenAPI with packageName parameter specified

However the problem is that not all generated files has packageName value from config.

Files

 

ApiClient.cs
ApiException.cs
Configuration.cs

 

are generated with default IO.Swagger.Client namespace. This is not correct I suppose

and Api\*.cs and Model\*.cs source code files are generated with custom namespace (This is correct)

 

I use curl command like below to generate client source code (it has to be executed using bash)

 

curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/csharp-dotnet2

Then I download archive using url from output (https://generator.swagger.io/api/gen/download/bf95a63d-5be5-4f46-89fc-720ab2a692f7)

 

The problem is that ApiClient.cs ApiException.cs and Configuration.cs files are generated with default IO.Swagger.Client namespace however I expect that namespace value have to be set to pet_store according to parameterization.

 

I replace namespace manually in the generated files however it would be nice to have namespace generated as it was parameterized.

When offline swagger-codegen is used with config file it generates namepace in the same way

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i https://petstore.swagger.io/v2/swagger.json -l csharp-dotnet2 -o D:\temp\cw -c D:\temp\cw\config.json

config.json:

{ "packageName" : "petT_store" } 

 

Is there any other option to set namespace for all generated files?

 

 

1 REPLY 1
Highlighted
New Contributor

Re: ApiClient ApiException Configuration namespaces do not match to packageName option

sorry, there is clientPackage option available

Please excuse me for inconvenience

 

Regards

New Here?
Join us and watch the welcome video:
Top Kudoed Authors