swagger-api / swagger-api/swagger-codegen

[JAVA] Bug in setter naming

Open
#11,142 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

Description

AbstractJavaCodegen class generates incorrect setter name for properties

Swagger-codegen version

2.4.21

Suggest a fix/enhancement

https://github.com/swagger-api/swagger-codegen/blob/b4bf476d0a1373b2a588c9a0bd5163155905cf8d/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java#L1053

Could be simply fixed:

codegenProperty.setter = toSetter(codegenProperty.name);

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 in modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java at line 1053, where the issue reports the setter naming problem. Compare the generated setter name with codegenProperty.name and verify that the resulting Java property setter uses the expected name.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.