swagger-api / swagger-api/swagger-codegen

[csharp-dotnet2] Generated code path for client does not match package name

Open
#9,988 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Command line used for generation
java -jar ./swagger-codegen-cli-3.0.15.jar generate -i MyProgram.yaml -l csharp-dotnet2 -o "client" --additional-properties packageName="MyProgram.Api" clientPackage="Atos.Tec.MyProgram.Api" modelPackage="Atos.Tec.MyProgram.Api" apiPackage="Atos.Tec.MyProgram.Api" invokerPackage="Atos.Tec.MyProgram.Api"
Description

I want all generated files to have the namespace Atos.Tec.MyProgram.Api, but the package Name should be shorter MyProgram.Api. For some reason the clientPackage parameter changes the namespace (correct) and the path of the generated files (wrong).

Swagger-codegen version

swagger-codegen-cli-3.0.15.jar

Steps to reproduce
  1. Use any example openapi Spec
  2. Run the above command with that spec and check the generated folder structure.
Suggest a fix/enhancement

It should use the same path as all other parameters (so without Atos/Tec).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command with swagger-codegen-cli-3.0.15.jar and an example OpenAPI spec, then inspect the csharp-dotnet2 generator's generated folder structure. Done means the namespace remains Atos.Tec.MyProgram.Api while the generated path uses the shorter MyProgram.Api package path without Atos/Tec.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.