https://kotlinlang.org logo
#ktor
Title
# ktor
x

xxfast

02/04/2022, 2:20 AM
is there an official openapi-generator for kotlin ktor client?
1
a

Aleksei Tirman [JB]

02/04/2022, 8:59 AM
Unfortunately, no. There is only one for the server.
x

xxfast

02/05/2022, 6:00 AM
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

Rafael Costa

03/15/2022, 5:19 PM
@xxfast how is that working for you? In our company we’re interested in generating ktor client for Android from Swagger file.
x

xxfast

03/15/2022, 11:53 PM
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

Meherdatta Chepuri

02/17/2023, 11:04 PM
Im getting
Project with path ':dispatchClient' could not be found in project ':shared'.
Did you generate it as a separate project outside shared module?
854 Views