OpenAPITools / OpenAPITools/openapi-generator
[REQ][kotlin-spring] Use DI to inject business logic into controller
Nobody has claimed this yet.
- 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.
Currently you have to change the generated implementation of the controller.
If the openapi.json file changes and you regenerate the code, the user code is overwritten.
Describe the solution you'd like
How about injecting a Service Interface into the Controller and the controller just calls this interface.
The Service Interface is also generated by the generator and the user has to write its Business Logic
within its own class which implement that interface. Through the Spring DI the user specifies
which implementation is injected. This separats the generated code from the user code.
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
The issue names the kotlin-spring controller generation but no files, tests, or entry points. Start by locating the kotlin-spring generator templates and its controller generation flow, then assess how a generated service interface and Spring-injected user implementation would fit. Done means generated code can be regenerated without overwriting the user's business logic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100