swagger-api / swagger-api/swagger-codegen
csharp: Add support for generating class structure
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm using the csharp code generator - I have quite a number of classes that are generated using the c# openapi generator. These generate names like "Company.Project.Models.Area.Entity" which are reasonably long. When codegen runs, it generates these all into a single "Models" folder with very long class names like "CompanyProjectModelsAreaEntity" which doesn't make sense for us. Is there any way to get the codegen to "rehydrate" the folder structure? Generating different swagger.json for example?
Swagger-codegen version
2.2.1
Swagger declaration file content or url
https://gist.github.com/evolvedlight/3db29eb489ab3af509480399d2e63510
Command line used for generation
java -jar ../swagger-codegen-cli-2.2.1.jar generate -i ../swagger.json -l csharp -DpackageName=Company.Namespace
Steps to reproduce
Run the generator. Notice that the class name generated is CompanyVendorProjectFolder1Folder2AnimalsPet instead of creating a nice csharp folder hierarchy
Related issues/PRs
Suggest a fix/enhancement
Someone tells me that this is possible, or is undesirable, or it would be liked and a patch welcomed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the C# generator behavior described in the issue, using the supplied Swagger gist and the swagger-codegen 2.2.1 command to reproduce the flattened class names. Determine the desired namespace-to-folder mapping and whether the generator should create that hierarchy; done would mean generated classes appear in the requested C# folder structure rather than one Models folder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100