Kotlin multiplatform client#3900
Conversation
Kotlin multiplatform allows Kotlin code to be shared across various target platforms. This implementation generates Swagger clients for JVM and iOS platforms.
eb95cd0 to
44fec6f
Compare
| ) | ||
|
|
||
| REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties | ||
| set ags=generate --artifact-id "kotlin-client-petstore-multiplatform" -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -g kotlin --library multiplatform -o samples\client\petstore\kotlin-multiplatform |
There was a problem hiding this comment.
For -i, please use modules\openapi-generator\src\test\resources\2_0\petstore.yaml instead
There was a problem hiding this comment.
Thanks. Updated.
|
Please run the following to update the documentation so as to address the CircleCI failure: |
| @Override | ||
| public Map<String, Object> postProcessModels(Map<String, Object> objs) { | ||
|
|
||
| // workaround for: https://github.com/swagger-api/swagger-codegen/issues/4258 |
There was a problem hiding this comment.
Do we still need this workaround?
I think the issue has been fixed in OpenAPI Generator
There was a problem hiding this comment.
Not sure. I couldn't find a reference to the issue in OpenAPI Generator (and I couldn't remember in what scenario it was necessary). I'll run through some tests and get back to you.
There was a problem hiding this comment.
Yes, please. If it's still an issue, we need to track it and get it fixed.
There was a problem hiding this comment.
Confirmed fixed. Unnecessary code removed.
|
I got the following errors when testing the multiplatform client locally: Is it supposed to work on Mac as well? |
Try it with the wrapper:
Yes. I've tested on Mac and Windows. |
|
Thanks for the tips. It works for me in my machine: |
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Too many empty lines. I'll see what I can do to fix these in a separate PR
wing328
left a comment
There was a problem hiding this comment.
LGTM. Tested locally and the result is good.
|
Thanks. Looking forward to community feedback and improvements. |
Support for the generation of Kotlin Multiplatform clients.
Background
The
kotlinlanguage defined in the Swagger Codegen project currently generates a Kotlin client that can run on the JVM. Somewhat recently, JetBrains introduced Kotlin Multiplatform, a platform that provides the ability to share code between various platforms: JVM, JS, iOS, Windows, etc. This pull request adds the ability to generate a Kotlin Multiplatform client.Library
The pull request includes Kotlin Multiplatform generation under the
kotlinlanguage and introduces two library options:jvm: (default) to target the existing Kotlin JVM generation.multiplatform: to target Kotlin Multiplatform generation.Limitations
The current pull request only currently adds support for JVM and iOS platforms but support for other platforms should be trivial to add.
At present,
dateanddate-timeobjects are rendered as strings. No attempt is made to integrate any third-party date/time libraries.Tests
The current implementation doesn't include any tests beyond those already included as part of the
kotlinlanguage implementation. A test project can be found here that generates thepetstoresample and includes tests to verify the correctness of the implementation.Comments welcome.
References
#3899
https://github.com/andrewemery/openapi-generator-kotlin-multiplatform-petstore