OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] "ID" in class names altered to "Id"
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
The behaviour leads to compile errors because of the file name / class name mismatch. The issue unveiled when trying to generate the code for the jira rest client.
openapi-generator version
5.0.1 (openapi-generator-maven-plugin)
OpenAPI declaration file content or url
Below the execution configuration of the maven plugin:
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>https://developer.atlassian.com/cloud/jira/platform/swagger-v3.v3.json</inputSpec>
<generatorName>java</generatorName>
<library>resttemplate</library>
<apiPackage>com.atlassian.jira.rest.client.api</apiPackage>
<modelPackage>com.atlassian.jira.rest.client.model</modelPackage>
<invokerPackage>com.atlassian.jira.rest.client</invokerPackage>
<groupId>com.atlassian.jira.rest</groupId>
<artifactId>client</artifactId>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
Command line used for generation
See execution definition above.
Steps to reproduce
Add above execution definiton to any maven java project using openapi-generator. Run commands maven clean, maven install.
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/3428
https://github.com/OpenAPITools/openapi-generator/issues/1692
Suggest a fix/enhancement
Define separate rule to handle the (sub)string "ID". Classes must not be renamed.
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 Maven plugin execution with the supplied Jira OpenAPI URL and Java generator configuration, then trace the Java model/class naming entry point. Confirm which generated class names containing "ID" are changed to "Id" and compare them with their file names. Done means the generated Java classes and files preserve the intended "ID" spelling and compile successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100