-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][KOTLIN][SPRING] Add option to skip generation of default implementations #5987
Comments
Does |
@cberry-chwy I am not sure, I am not working anymore on this project. |
Hello, I agree that the behavior of having a default controller interface implementation is not really practical. I would expect the existing code to stop compiling when we add new API methods. Looking at https://github.com/borsch/openapi-generator/blob/d6bbd51b5078dde410e811f9964bc72259dfe96d/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache and https://github.com/borsch/openapi-generator/blob/d6bbd51b5078dde410e811f9964bc72259dfe96d/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache, I suggest to only add a body to the method in case there is a service interface. WDYT? |
Totally agree, I want to get compilation error, where I add new methods in API |
Looks like the |
@wing328 Can be closed, as the |
another way to skip certain files from being generated is to use to pre-populate this file pre-code generation, please use the option |
Bug Report Checklist
Description
There should be an option the deactivate the generation of code which makes use of supporting files.
openapi-generator version
Version 4.3.0
OpenAPI declaration file content or url
api.yml:
build.gradle:
Command line used for generation
The gradle plugin was used (
id 'org.openapi.generator' version '4.3.0'
).Steps to reproduce
Use the api.yml and the gradle config to generate the API. There will be default implementations in the *Delegate interfaces which use ApiUtil.kt.
Related issues/PRs
Issue #5476
Suggest a fix
Provide an option to disable code generation for the delegate classes. Like the Java Spring generator has with
skipDefaultInterface
.Note that
interfaceOnly
is no solution because it will prevent generation of the REST controller classes.Also note that
supportingFiles: "ApiUtil,kt"
fixes the missing class reference, but requires to deactivate stricter null checks (prevenst use of-Xjsr305=strict
compiler args). See #5476.My workaround so far is to provide my own (null-safe) implementation of ApiUtil.
The text was updated successfully, but these errors were encountered: