Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2085
Closed
Open
Issue created Feb 07, 2019 by Administrator@rootContributor

[BUG] [Java] Getter/Setter naming convention not followed in generated models

Created by: karismann

Description

When generating a client library, the getters/setters for a field pId are getPId() and setPId(). As per naming conventions, this is wrong :

  • https://stackoverflow.com/questions/2948083/naming-convention-for-getters-setters-in-java
  • https://download.oracle.com/otn-pub/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/beans.101.pdf?AuthParam=1548672501_cd9f95cc049ee0220b70f6c448b2a095 (chapter 8)
  • https://dertompson.com/2013/04/29/java-bean-getterssetters/

This should be getpId() and setpId()

openapi-generator version

4.0.0-SNAPSHOT

OpenAPI declaration file content or url
...
"xField" : {
   "type" : "string"
},
...
Command line used for generation
Steps to reproduce

Here also the automated getter and setter generated by IntelliJ for this property :

public class TestClass {

    String pId;

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

}
Related issues/PRs

https://github.com/swagger-api/swagger-codegen/issues/8282

Suggest a fix

I will send a PR

Assignee
Assign to
Time tracking