Any good OpenAPI generators out there for KMP? Bon...
# multiplatform
e
Any good OpenAPI generators out there for KMP? Bonus points for wasmJs support!
h
Didn’t try, we have our own, but there are existing Ktor client and server generators.
j
I've used this one. It should work for KMP with
library = multiplatform
,
serializationLibrary = kotlinx_serialization
, and
dateLibrary = kotlinx-datetime
.
e
Thanks! @Jeff Lockhart how was the quality of the plugin and the generated code?
j
I found the generated code satisfactory for the API I used it with. I ran into a few hiccups, but most I was able to fix in the spec definition. I ended up using Jackson for serialization, since I didn't need KMP support. I can't recall why I switched from kotlinx-serialization though. It might have just been easier to do something.
I never got the code generation fully configured as part of my project's build. It generates an entire Gradle parent project. I ended up having to manually fix a generic type error in one of the APIs and also fixed some duplicate classes (the code worked as it was, but was redundant). Since my API doesn't change often, I just added the generated code with my fixes to my own source code instead of having it generate on each build.