Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/utils/test_file_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@
sha256: b2093528aac971193f2863a70f46eea45cf8bda79120b133a614599e80d8b46d
- filename: "samples/server/petstore/rust-axum/output/openapi-v3/tests/oneof_untagged.rs"
sha256: 1d3fb01f65e98290b1d3eece28014c7d3e3f2fdf18e7110249d3c591cc4642ab
- filename: "samples/client/petstore/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/integration/PetApiTest.kt"
sha256: 82a6be39c1ed3dada96dfa1833a6709834cb3f9f9d50a19cbd9d49699e46df4f
- filename: "samples/client/petstore/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/integration/UserApiTest.kt"
sha256: bc64fb94857a3598e1332f1278307c3078ea9ec4b4aa75690e6eda86e9729a8d
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ kotlin {
explicitApi()
}
{{/explicitApi}}
{{#jvm-spring-webclient}}{{#useSpringBoot3}}
{{#jvm-spring-webclient}}
{{#useSpringBoot3}}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
{{/useSpringBoot3}}{{/jvm-spring-webclient}}
{{/useSpringBoot3}}
{{/jvm-spring-webclient}}
{{#jvm-spring-restclient}}

kotlin {
Expand Down Expand Up @@ -219,7 +221,6 @@ dependencies {
{{/jackson}}
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
{{/jvm-retrofit2}}
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
{{#jvm-vertx}}
implementation "io.vertx:vertx-web-client:$vertx_version"
implementation "io.vertx:vertx-core:$vertx_version"
Expand All @@ -229,6 +230,10 @@ dependencies {
implementation "io.vertx:vertx-lang-kotlin-coroutines:$vertx_version"
{{/useCoroutines}}
{{/jvm-vertx}}
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
{{#jvm-spring}}
testImplementation "org.springframework.boot:spring-boot-test:$spring_boot_version"
{{/jvm-spring}}
}
{{#kotlinx_serialization}}

Expand Down
1 change: 0 additions & 1 deletion samples/client/echo_api/kotlin-jvm-okhttp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
Expand All @@ -67,6 +66,7 @@ dependencies {
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.20.0"
implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
testImplementation "org.springframework.boot:spring-boot-test:$spring_boot_version"
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ test {
useJUnitPlatform()
}


kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand All @@ -69,6 +67,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
implementation "io.projectreactor:reactor-core:3.7.11"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
testImplementation "org.springframework.boot:spring-boot-test:$spring_boot_version"
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
Expand Down
1 change: 0 additions & 1 deletion samples/client/others/kotlin-integer-enum/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
1 change: 0 additions & 1 deletion samples/client/petstore/kotlin-explicit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ kotlin {
explicitApi()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
1 change: 0 additions & 1 deletion samples/client/petstore/kotlin-gson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.google.code.gson:gson:2.13.2"
Expand Down
1 change: 0 additions & 1 deletion samples/client/petstore/kotlin-jackson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
Expand Down
1 change: 0 additions & 1 deletion samples/client/petstore/kotlin-jvm-jackson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
1 change: 0 additions & 1 deletion samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.google.code.gson:gson:2.13.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Expand All @@ -62,6 +61,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
implementation "io.projectreactor:reactor-core:3.7.11"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
testImplementation "org.springframework.boot:spring-boot-test:$spring_boot_version"
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test {
useJUnitPlatform()
}


kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
Expand All @@ -67,6 +66,7 @@ dependencies {
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.20.0"
implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
testImplementation "org.springframework.boot:spring-boot-test:$spring_boot_version"
}

java {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.openapitools.integration

import io.kotlintest.matchers.collections.shouldHaveSize
import io.kotlintest.specs.ShouldSpec
import org.openapitools.client.apis.PetApi
import org.springframework.boot.test.web.client.MockServerRestClientCustomizer
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType.APPLICATION_JSON
import org.springframework.test.web.client.match.MockRestRequestMatchers.method
import org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo
import org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess
import org.springframework.web.client.RestClient

class PetApiTest : ShouldSpec() {
init {
should("find by status passing a query parameter with a list of values") {
val restClientBuilder: RestClient.Builder = RestClient.builder()
val mockServer = MockServerRestClientCustomizer().let {
it.customize(restClientBuilder)
it.getServer(restClientBuilder)
}
val petApi = PetApi(restClientBuilder.build())

mockServer.expect(requestTo("/pet/findByStatus?status=pending,available"))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess("[]", APPLICATION_JSON))

val response = petApi.findPetsByStatus(listOf(PetApi.StatusFindPetsByStatus.pending, PetApi.StatusFindPetsByStatus.available))

mockServer.verify()

response shouldHaveSize 0
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.openapitools.integration

import io.kotlintest.shouldBe
import io.kotlintest.specs.ShouldSpec
import org.openapitools.client.apis.UserApi
import org.springframework.boot.test.web.client.MockServerRestClientCustomizer
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType.TEXT_PLAIN
import org.springframework.test.web.client.match.MockRestRequestMatchers.method
import org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo
import org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess
import org.springframework.web.client.RestClient

class UserApiTest : ShouldSpec() {
init {
should("call login user passing a query parameter with a single value") {
val restClientBuilder: RestClient.Builder = RestClient.builder()
val mockServer = MockServerRestClientCustomizer().let {
it.customize(restClientBuilder)
it.getServer(restClientBuilder)
}
val userApi = UserApi(restClientBuilder.build())

mockServer.expect(requestTo("/user/login?username=myUsername&password=myPassword"))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess("login response", TEXT_PLAIN))

val response = userApi.loginUser("myUsername", "myPassword")

mockServer.verify()

response shouldBe "login response"
}
}
}
Loading
Loading