is there an official openapi-generator for kotlin ...
# ktor
x
is there an official openapi-generator for kotlin ktor client?
1
a
Unfortunately, no. There is only one for the server.
x
actually found out that there is. Just need to set the library to
multiplatform
and it uses ktor https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/kotlin.md
I managed to get it to work with just
Copy code
openApiGenerate {
  generatorName.set("kotlin")
  library.set("multiplatform")
}
r
@xxfast how is that working for you? In our company we’re interested in generating ktor client for Android from Swagger file.
x
Was able to hook this into the build system, but ran into multiple issues 1.
openapigenerate
task doesn’t get triggered by default. You need to explicitly set up the build dependency to it and I’m not sure how to do this 💯 in a multiplatform project - given that the compile task is different for different platforms you target. More about this in the thread here 2. the current multiplatform template doesn’t seems to work with kotlinx-datetime formats. Raised this in a thread here but that didn’t really go anywhere. There is also this stackoverflow post about this i think 3. the current multiplatform template comes with a bunch of utility classes and authentication boilerplate that I don’t really need (my authentication feature is installed on the client in a different module elsewhere) Due to these reasons, i decided not to automate
openapigenerate
tasks in to build - but if these gets addressed in the future, i might revisit this
m
Im getting
Project with path ':dispatchClient' could not be found in project ':shared'.
Did you generate it as a separate project outside shared module?
t
I tried it know, it works quite good, even with kotlinx-datetime. But main issue is that I don't need multiplatform project (at least not know). I would like to generate just Android part and just code, without build script and gradle wrapper, it now generate whole gradle module.
1090 Views