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.29k stars 6.44k forks source link

[KOTLIN MULTIPLATFORM] Compilation errors related to Kotlinx.serialization #8862

Open rahul-ramanujam opened 3 years ago

rahul-ramanujam commented 3 years ago
Description

I am trying to use openapi-generator for a multiplatform project and I started with the petstore api as described in this reddit post. I am unable to run ./gradlew assemble on the multiplatform project and gettin some compilation errors which seems related to Kotlinx.serialization library. I have added the different artifacts and steps followed to reproduce this error.

openapi-generator version

openapi-jar-version: 5.0.1 openapi-jar : https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.1/openapi-generator-cli-5.0.1.jar

OpenAPI declaration file content or url

yaml file : https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

Command line used for generation

java -jar openapi-generator-cli.jar generate -g kotlin -i petstore.yaml --library multiplatform -o /var/tmp/kotlin/

Steps to reproduce
  1. Download openapi-generator-cli
  2. Download petstore.yaml
  3. Update distributionUrl in gradlew-wrapper.properties to distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
  4. Update following version in build.gradle
  1. run ./gradlew version
Related issues/PRs

stacktrace : https://gist.github.com/RahulRvR/cc4e8bc52373baa0862f125da888c09a

Suggest a fix/enhancement
etwilliams commented 3 years ago

I'm able to build the JVM library but any iOS one fails for me as well. I think the generated source is out of data in relation to the current ktor and serialization versions.

etwilliams commented 3 years ago

Switching back to version openapi-generator 5.0.0 works without issues.

etwilliams commented 3 years ago

If want to use a newer version of Kotlin (1.4.32), check out this PR that hopefully gets merged: https://github.com/OpenAPITools/openapi-generator/pull/9232

837 commented 3 years ago

I updated it a bit more and fixed open issues. https://github.com/OpenAPITools/openapi-generator/pull/9755