swagger-api / swagger-api/swagger-codegen
[C#] Add modelPropertyNaming config option
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I have recently joined a big project that is using swagger-codegen. However some custom classes has been added to account for a bunch of properties that the swagger input file did not originally contain. E.g. SomeClass generated by swagger could have been inherited by SomeClassCustom created manually.
As a newcommer to the project I have been given the task to do some cleanup, and add all the properties to the swagger input file, generate again, and then remove the custom classes that would no longer be needed.
The problem is that the custom classes added contains variables named something like: Brand__c, and when added to the input file, swagger will transform it into BrandC. I know that swagger is generating PascalCase for C#, but in this case it will break the code previously refering to the Brand__c property.
As far as I understand, this could be fixed if the C# generator had the "modelPropertyNaming": "original" option like TypeScript, but that option is not currently a part of the C# generator as far as I can tell. In a case like this, I think it would be a nice option to use with the C# generator, even though it would be conflicting with the conventions for C# code.
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 by locating the C# generator's model-property naming logic and compare it with the TypeScript generator's existing modelPropertyNaming option. Done means the C# generator accepts "original" and preserves names such as Brand__c, with coverage for the configured behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100