OpenAPITools / OpenAPITools/openapi-generator
[BUG] openapi-generator-maven-plugin delegatePattern generates non-compilable result
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
yes, and I've pushed it to https://github.com/chiefrocker86/spring-boot-openapi-gen - Have you validated the input using an OpenAPI validator (example)?
Yes, using https://oas-validation.com/ - Have you tested with the latest master to confirm the issue still exists?
yes (I guess. I've been usign openapi-generator-maven-plugin version 7.10.0) - Have you searched for related issues/PRs?
yes, but the related issues are really really old or don't fit. - What's the actual output vs expected output?
Non-compilabe code vs compilable code - [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I'm using the openapi-generator-maven-plugin in my spring boot (3) project to generate models and apis according to my OAIs.
I want to use the delegatePattern, but the generated code won't compile.
The culprit (I guess) lies in the generated controller, which needs to implement the generated API, but doesn't properly.
In this very case the controller should be generated like (I guess)
https://github.com/chiefrocker86/spring-boot-openapi-gen/blob/feature/codegen-expected/src/main/java/org/fkeller/spring/boot/openapi/gen/rest/MessageApiController.java.expected
Of course it could be that I'm using the plugin wrongly.
openapi-generator version
7.10.0
OpenAPI declaration file content or url
Generation Details
https://github.com/chiefrocker86/spring-boot-openapi-gen/blob/feature/codegen-expected/pom.xml
Steps to reproduce
git clone https://github.com/chiefrocker86/spring-boot-openapi-gen.git
&& cd spring-boot-openapi-gen
&& git checkout feature/codegen-expected
&& mvn clean verify
Related issues/PRs
Suggest a fix
The generation of the ApiController, which implements the Api should generate the implementation of the methods by using the delegate.
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
Clone the linked spring-boot-openapi-gen repository, check out feature/codegen-expected, and run mvn clean verify using its pom.xml and openapi.yml. Compare the generated MessageApiController.java with MessageApiController.java.expected and trace the delegatePattern generation. Done means the generated controller implements the API correctly and the reproduction project compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100