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
  • #5136
Closed
Open
Issue created Jan 29, 2020 by Administrator@rootContributor

[REQ] Load templates from classpath

Created by: eicki

Is your feature request related to a problem? Please describe.

Currently the only way to overwrite embedded templates is to use the templateDir. If openapi generator is used in multiple projects that should share all the same customized templates you have to copy the templates to each project or to fork and adjust he generator project itself and adjust the embedded templates directly.

Describe the solution you'd like

Add a templateResourcePath option that if set defines a resource path in the classpath to look for templates files. If both templateDir and templateResourcePath is set, template files from templateDir should take precedence. By doing so you can define a company wide set of templates that overwrite the embedded templates but still allowing to overwrite templates on a per api basis.

Describe alternatives you've considered

Extending templateDir to allow a comma-separated list of directories and allowing Spring like "classpath:" prefix denoting paths that should be resolved via classloader. But I did not opt for this option because templateDir is already a File and not a String, so you would need to alter this and in the end it sounded a little bit too much. Thus I decided for a new option.

Additional context

Pull Request will follow.

Assignee
Assign to
Time tracking