swagger-api / swagger-api/swagger-codegen
io.swagger.codegen.v3.CodegenModel class has public member variables
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The CodegenModel class declares all the member variables as public. Interestingly they also provider getter/setter methods for all of them. The DefaultGenerator code directly references the member variables breaking encapsulation and preventing wrapping of these classes using (for instance) the decorator pattern. There is no reason to do this. These members should be declared as private or protected.
Swagger-codegen version
v3.0.4
Suggest a fix/enhancement
Make these member variables private/protected and avoid use of this pattern. Remove direct access of member variables from associated 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 CodegenModel class and the DefaultGenerator code that directly accesses its member variables. Review the existing getter and setter methods, then identify associated direct field access that must be replaced. Done means the fields are private or protected and the affected code no longer accesses them directly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100