OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.81k stars 6.58k forks source link

[REQ] [Kotlin-Vertx-Server] Kotlin Vertx Server Generator #3024

Open Wooyme opened 5 years ago

Wooyme commented 5 years ago

May I add Kotlin-Vertx Server generator for this project.

wing328 commented 5 years ago

Sure we definitely welcome contribution on that.

Have you tried the following existing Kotlin server stub generators?

If it's not very different, then we can add an option (e.g. library) to support Vertx in one of the Kotlin server generator above.

Wooyme commented 5 years ago

Actually, the kotlin vertx server is similar to the java one, but there are some problems in the java one. The vertx-swagger-router created by phiz71 is out of date. So I made the vertx-openapi-router which works well with OpenAPI 3.0. And of course, there are some other features provided by Kotlin and I'd like to see them in Kotlin Vertx Server.

slinkydeveloper commented 5 years ago

@Wooyme you can use the official package https://vertx.io/docs/vertx-web-api-contract/kotlin/

Links to #115

Wooyme commented 5 years ago

@Wooyme you can use the official package https://vertx.io/docs/vertx-web-api-contract/kotlin/

Links to #115

I have tried it before. It works well, but not so convient I think. as I have to write model myself and it's complex if I want to use coroutine.

reaperdtme commented 5 years ago

@Wooyme currently breaks when using oneOf: image image

wing328 commented 5 years ago

oneOf (OAS v3 new feature) is not yet supported in the Kotlin server. Of course, we welcome contributions to implement its support in Kotlin and other generators.

reaperdtme commented 5 years ago

@Wooyme @wing328 Response<Void> response types are impossible in Kotlin. 204 No Content responses need to be supported with Response<Unit> instead of Response<Void> or use Response<Void?> to allow null to be passed in.

image

wing328 commented 5 years ago

@Wooyme thanks for the feedback. Do you submitting a PR for that? I can show you some good starting points.