OpenAPITools / OpenAPITools/openapi-generator

[REQ] Feign Configuration should be named after the classname

Open
#6,737 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist

At the moment each generated feign client has the following configuration:

Description
@Configuration
@EnableConfigurationProperties
public class ClientConfiguration {

This is a grave problem as it only allows for one feign client per spring application: if 2 or more are present the application will crash because it will find 2 identical bean in 2 different packages ("ClientConfiguration" bean, indeed).

openapi-generator version

Present in all versions

Suggest a fix

Simply make "className" available in the clientConfiguration.mustache (dunno why it is not present at the moment...) and alter the template by doing:

@Configuration
@EnableConfigurationProperties
public class {{classname}}ClientConfiguration {

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 with the generated Feign client's clientConfiguration.mustache template and inspect how classname is exposed to templates. Update the configuration class naming so multiple generated clients do not produce identical ClientConfiguration beans, then verify the generated Java output for distinct client class names.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.