OpenAPITools / OpenAPITools/openapi-generator

[REQ][Spring] Support apiNamePrefix and apiNameSuffix

Open
#8,655 1 comment 0 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

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

I'd like to generate api clients for Ory Hydra and Ory Kratos. My current problem is, that both specs use the tags admin and public. This leads to equally named api client classes from both specs (AdminApiClient and PublicApiClient). Therefore I'd like to prefix the generated api clients with the service name to avoid collisions and improve the readability of my code.

Describe the solution you'd like

I'd like to extend SpringCodegen to support config options apiNamePrefix and apiNameSuffix like the DefaultCodegen does.

Describe alternatives you've considered

I didn't find any other options to change the class name of the generated api definitions.

Additional context

Schemas with colliding tag definitions:

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 comparing SpringCodegen with DefaultCodegen to understand how apiNamePrefix and apiNameSuffix are configured and applied to generated API client names. Done means SpringCodegen accepts both options and generated clients avoid collisions for tagged APIs such as the Ory Hydra and Ory Kratos examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.