OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAVA][WebClient] Name clashing between headers and query parameters - Maven plugin
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
If I have in the yaml defined two field with same name but different "in" property (like "header" and "query"), the generated method take in input only one value (the header one) and don't map the query parameter.
openapi-generator version
I used 6.6.0 and 7.12.0 versions of the maven plugin. in both I have that problem
OpenAPI declaration file content or url
I included the openapi declaration used, the generated code which have only 1 parameter abi (instead of one for query and one for header) and the pom configuration of plugin.
<script src="https://gist.github.com/mtamburi/88811966272c4483987f5df82c23c497.js"></script>I'm expecting that the method of the API class take 3 parameters as input.
Generation Details
The generation was tested both with a Java 1.8 and Spring application (plugin version) and also with Java 17 and Spring Boot 3 application.
Steps to reproduce
I run a maven command "clean compile" for generating client code
Suggest a fix
Do a workaround exist to generate the client in the right way without modifying the openapi (that for my case is an external contract)?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OpenAPI declaration and generated Java code included in the linked gist, then trace the Java WebClient generator used by the Maven plugin. Compare the header and query parameters in the generated API method. Done means a clean compile generates separate inputs for both fields and the expected three method parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100