OpenAPITools / OpenAPITools/openapi-generator
Java code generation fails with id & setId field names
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I have a Java model class that has these fields (and more).
private String id;
private String setId;
openapi-generator version
7.10.0
OpenAPI declaration file content or url
type: object
properties:
id:
description: "Unique identifier of the record."
maxLength: 36
minLength: 1
type: string
example: 3b0b1b1a-a3c0-4267-894a-0c40cb84a5af
setId:
description: User-defined ID.
type: string
example: 2b0b1b1a-a3c0-4267-894a-0c40cb84a5af
Generation Details
Steps to reproduce
The issue is that the codegen tool has correctly made the setId() method for the id field but then it makes another setId() method for the setId field which is incorrect. It should be making a setSetId() method for the setId field.
How to fix/resolve this?
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 reproducing the failure with the provided OpenAPI declaration and the Maven OpenAPI codegen plugin on openapi-generator 7.10.0. Trace Java model generation for the id and setId properties, then verify that compilation succeeds with setId(String) for id and setSetId(String) for setId.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100