openapi-generator
openapi-generator copied to clipboard
[BUG][KOTLIN] kotlin-spring generator flag appendRequestToHandler generates broken code when used with flag delegatePattern
Bug Report Checklist
- [ ] Have you provided a full/minimal spec to reproduce the issue?
- [x] Have you validated the input using an OpenAPI validator (example)?
- [ ] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] What's the actual output vs expected output?
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating Kotlin code with kotlin-spring generator using both the flags
- appendRequestToHandler
- delegatePattern
I get classess
- xxApi
- xxApiController
- xxApiDelegate
- xxApiController seems fine. It extends xxApi.
- xxApi has a correct function signature with ServerHttpRequest as the last argument, but it calls the delegate without the ServerHttpRequest argument.
- xxApiDelegate does not compile, because it has a broken function signature. It has an additional nullable argument without a name, and type like this ": ?"
openapi-generator version
7.5.0
Related issues/PRs
Feature request for appendRequestToHandler: https://github.com/OpenAPITools/openapi-generator/pull/17158 PR: https://github.com/OpenAPITools/openapi-generator/pull/17158
Suggest a fix
Support for appendRequestToHandler was added in PR https://github.com/OpenAPITools/openapi-generator/pull/17158, and it shows no changes for apiDelegate.mustache. This leads to believe that the delegate pattern was not addressed when adding the appendRequestToHandler feature.