OpenAPITools / OpenAPITools/openapi-generator

[REQ] easier and more consistent package name configuration

Open
#5,761 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

With openapi-generator-plugin 4.3.0, there are currently 4 package name configuration options:

  1. packageName
  2. apiPackage
  3. modelPackage
  4. invokerPackage

In configOptions, you can even specify a basePackage, adding more options for confusion...
Note that even the name of the options is not consistent;)
It is rarely needed to tweak each and every single option individually, I guess most projects will just want to define one name that is then suffixed with api and model, respectively.

So I'd propose to:

  • use packageName synonymously with basePackage and use that as a base name for all other package names by default, unless explicitly overridden with the existing options
  • deprecate all other package options and introduce apiPackageSuffix and modelPackageSuffix etc. to fine tune those if really needed (default should be api, model,… instead of the current ...apiPackage which is redundantly including "package" in the name itself
  • don't default to openapi.generator.maven.plugin since this won't make sense for any project except for this one - a better default would be to use the groupId+artifactId from the POM of the project that uses openapi-generator

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how packageName, basePackage, apiPackage, modelPackage, and invokerPackage are handled in the openapi-generator-plugin 4.3.0 configuration. Review the plugin's Maven project defaults, including groupId and artifactId handling, before deciding how suffixes and deprecated options should interact. Done means one consistent base package, configurable suffixes, preserved overrides, and an appropriate project-derived default.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.