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
  • #2864
Closed
Open
Issue created May 10, 2019 by Administrator@rootContributor

[REQ] How to adjust the file name of a generated java class?

Created by: Emdee89

I played around with creating by own custom template for Java Resttemplate. This works quite nice!

My aim is to alter the class name of the generated API classes. I did so by changing api.mustache:

...
public class {{classVarName}} {
  private ApiClient apiClient;
...

I replaced {{className}} by {{classVarName}} and the output is as expected.

However, Java requires that the class name and the file name are the same.

It appears that the generated Java file name is built with the variable {{className}}.

Suppose my API is named My Service, then the file would be named MyServiceApi.java, and the code would be public class MyService.

How can I alter the file name of the Java class?

Assignee
Assign to
Time tracking