-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[KOTLIN Spring] add interfaceOnly option #3050
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
[KOTLIN Spring] add interfaceOnly option #3050
Conversation
Can you please resolve the merge conflicts when you've time? |
# Conflicts: # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java # modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache
# Conflicts: # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt
# Conflicts: # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this implementation. I think we'll need to put the interface definition into a file other than api.mustache
and change the default behavior back to using api.mustache
. If not, this becomes a breaking change.
I'll have to look at how we might make serviceImplementation
and interfaceOnly
options less confusing.
@@ -57,19 +55,19 @@ import kotlin.collections.Map | |||
@RequestMapping("\${api.base-path:<%contextPath%>}") | |||
<%={{ }}=%> | |||
{{#operations}} | |||
class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) val service: {{classname}}Service{{/serviceInterface}}) { | |||
interface {{classname}} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing api.mustache
to an interface class breaks convention we use elsewhere, and will cause anyone with custom templates to break (as the default interfaceOnly=false
loads a file that didn't previously exist.
I've tagged this as "Breaking change without fallback" since it will break custom templates as-is. |
@jimschubert @wing328 I think the Shippable check is broke at the moment. I don't see any mistake by the PR. |
@fj-roman shippable has been failing to download dependencies for the docker image today. |
@jimschubert I removed the breaking change, can you please review the PR again. |
# Conflicts: # samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION # samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt # samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt # samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt # samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt # samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt # samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt
The breaking change was removed. This looks good at quick glance, but I'll try it out tonight and merge if no other concerns. |
# Conflicts: # samples/client/petstore/perl/t/AnotherfakeApiTest.t
# Conflicts: # samples/client/petstore/perl/t/AnotherFakeApiTest.t
@fj-roman sorry it took a bit to evaluate after you pinged me on Gitter, but this has been merged as of a couple days ago. Just wanted to notify in case you didn't see. Thanks for the contribution! |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master
,4.1.x
,5.0.x
. Default:master
.@jimschubert (2017/09) heart, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04)
Description of the PR
Add interfaceOnly option for kotlin-spring. Now you can write down you own Controller Classes and implement the API-Interfaces.
I'm not certain about the combination of the properties interfaceOnly and serviceImplementation. Maybe it's confusing.