-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix Kotlin-client: Can now handle default dataclass values for mul…
…tiplatform (#12242)
- Loading branch information
Showing
67 changed files
with
2,511 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
generatorName: kotlin | ||
outputDir: samples/client/petstore/kotlin-bigdecimal-default-multiplatform | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_10866_bigdecimal_default.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client | ||
additionalProperties: | ||
artifactId: kotlin-bigdecimal-default-multiplatform | ||
library: multiplatform |
5 changes: 3 additions & 2 deletions
5
bin/configs/kotlin-bigdecimal-default.yaml → ...gs/kotlin-bigdecimal-default-okhttp4.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
generatorName: kotlin | ||
outputDir: samples/client/petstore/kotlin-bigdecimal-default | ||
outputDir: samples/client/petstore/kotlin-bigdecimal-default-okhttp4 | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_10866_bigdecimal_default.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client | ||
additionalProperties: | ||
artifactId: kotlin-bigdecimal-default | ||
artifactId: kotlin-bigdecimal-default-okhttp4 | ||
library: jvm-okhttp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
29 changes: 29 additions & 0 deletions
29
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
README.md | ||
build.gradle.kts | ||
docs/Apa.md | ||
docs/DefaultApi.md | ||
gradle/wrapper/gradle-wrapper.jar | ||
gradle/wrapper/gradle-wrapper.properties | ||
gradlew | ||
gradlew.bat | ||
settings.gradle.kts | ||
src/commonTest/kotlin/util/Coroutine.kt | ||
src/iosTest/kotlin/util/Coroutine.kt | ||
src/jsTest/kotlin/util/Coroutine.kt | ||
src/jvmTest/kotlin/util/Coroutine.kt | ||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt | ||
src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt | ||
src/main/kotlin/org/openapitools/client/auth/Authentication.kt | ||
src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt | ||
src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt | ||
src/main/kotlin/org/openapitools/client/auth/OAuth.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt | ||
src/main/kotlin/org/openapitools/client/models/Apa.kt |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.0.0-SNAPSHOT |
41 changes: 41 additions & 0 deletions
41
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# org.openapitools.client - Kotlin client library for Demo | ||
|
||
## Requires | ||
|
||
* Kotlin 1.5.10 | ||
|
||
## Build | ||
|
||
``` | ||
./gradlew check assemble | ||
``` | ||
|
||
This runs all tests and packages the library. | ||
|
||
## Features/Implementation Notes | ||
|
||
* Supports JSON inputs/outputs, File inputs, and Form inputs. | ||
* Supports collection formats for query parameters: csv, tsv, ssv, pipes. | ||
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. | ||
|
||
|
||
<a name="documentation-for-api-endpoints"></a> | ||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *http://localhost* | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
*DefaultApi* | [**testPost**](docs/DefaultApi.md#testpost) | **POST** /test | | ||
|
||
|
||
<a name="documentation-for-models"></a> | ||
## Documentation for Models | ||
|
||
- [org.openapitools.client.models.Apa](docs/Apa.md) | ||
|
||
|
||
<a name="documentation-for-authorization"></a> | ||
## Documentation for Authorization | ||
|
||
All endpoints do not require authorization. |
99 changes: 99 additions & 0 deletions
99
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | ||
|
||
plugins { | ||
kotlin("multiplatform") version "1.6.0" // kotlin_version | ||
kotlin("plugin.serialization") version "1.6.0" // kotlin_version | ||
} | ||
|
||
group = "org.openapitools" | ||
version = "1.0.0" | ||
|
||
val kotlin_version = "1.6.0" | ||
val coroutines_version = "1.5.2" | ||
val serialization_version = "1.3.0" | ||
val ktor_version = "1.6.4" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
jvm() | ||
ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } } | ||
js { | ||
browser() | ||
nodejs() | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version") | ||
api("io.ktor:ktor-client-core:$ktor_version") | ||
api("io.ktor:ktor-client-json:$ktor_version") | ||
api("io.ktor:ktor-client-serialization:$ktor_version") | ||
} | ||
} | ||
|
||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
implementation("io.ktor:ktor-client-mock:$ktor_version") | ||
} | ||
} | ||
|
||
val jvmMain by getting { | ||
dependencies { | ||
implementation(kotlin("stdlib-jdk7")) | ||
implementation("io.ktor:ktor-client-cio-jvm:$ktor_version") | ||
} | ||
} | ||
|
||
val jvmTest by getting { | ||
dependencies { | ||
implementation(kotlin("test-junit")) | ||
} | ||
} | ||
|
||
val iosMain by getting { | ||
dependencies { | ||
api("io.ktor:ktor-client-ios:$ktor_version") | ||
} | ||
} | ||
|
||
val iosTest by getting | ||
|
||
val jsMain by getting { | ||
dependencies { | ||
api("io.ktor:ktor-client-js:$ktor_version") | ||
} | ||
} | ||
|
||
val jsTest by getting | ||
|
||
all { | ||
languageSettings.apply { | ||
useExperimentalAnnotation("kotlin.Experimental") | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
register("iosTest") { | ||
val device = project.findProperty("device")?.toString() ?: "iPhone 8" | ||
dependsOn("linkDebugTestIosX64") | ||
group = JavaBasePlugin.VERIFICATION_GROUP | ||
description = "Execute unit tests on ${device} simulator" | ||
doLast { | ||
val binary = kotlin.targets.getByName<KotlinNativeTarget>("iosX64").binaries.getTest("DEBUG") | ||
exec { | ||
commandLine("xcrun", "simctl", "spawn", device, binary.outputFile) | ||
} | ||
} | ||
} | ||
register("test") { | ||
dependsOn("allTests") | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/docs/Apa.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
# Apa | ||
|
||
## Properties | ||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**bepa** | **kotlin.Double** | | | ||
**cepa** | **kotlin.Double** | | | ||
**depa** | **kotlin.Double** | | [optional] | ||
**epa** | **kotlin.Double** | | [optional] | ||
**fepa** | **kotlin.Double** | | [optional] | ||
**gepa** | **kotlin.Double** | | [optional] | ||
|
||
|
||
|
53 changes: 53 additions & 0 deletions
53
samples/client/petstore/kotlin-bigdecimal-default-multiplatform/docs/DefaultApi.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# DefaultApi | ||
|
||
All URIs are relative to *http://localhost* | ||
|
||
Method | HTTP request | Description | ||
------------- | ------------- | ------------- | ||
[**testPost**](DefaultApi.md#testPost) | **POST** /test | | ||
|
||
|
||
<a name="testPost"></a> | ||
# **testPost** | ||
> testPost(apa) | ||
|
||
|
||
### Example | ||
```kotlin | ||
// Import classes: | ||
//import org.openapitools.client.infrastructure.* | ||
//import org.openapitools.client.models.* | ||
|
||
val apiInstance = DefaultApi() | ||
val apa : Apa = // Apa | | ||
try { | ||
apiInstance.testPost(apa) | ||
} catch (e: ClientException) { | ||
println("4xx response calling DefaultApi#testPost") | ||
e.printStackTrace() | ||
} catch (e: ServerException) { | ||
println("5xx response calling DefaultApi#testPost") | ||
e.printStackTrace() | ||
} | ||
``` | ||
|
||
### Parameters | ||
|
||
Name | Type | Description | Notes | ||
------------- | ------------- | ------------- | ------------- | ||
**apa** | [**Apa**](Apa.md)| | | ||
|
||
### Return type | ||
|
||
null (empty response body) | ||
|
||
### Authorization | ||
|
||
No authorization required | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: Not defined | ||
|
Binary file added
BIN
+57.8 KB
...client/petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...petstore/kotlin-bigdecimal-default-multiplatform/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.