From de00cedf7420121be841f60c27a3a1e3ec307820 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Thu, 8 Aug 2024 19:19:51 +0200 Subject: [PATCH 1/3] Fix compile issue with RequestType and multiple parameters --- .../ktorfit/reqBuilderExtension/RequestConverterText.kt | 8 ++++++-- .../kotlin/de/jensklingenberg/ktorfit/RequestTypeTest.kt | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ktorfit-ksp/src/main/kotlin/de/jensklingenberg/ktorfit/reqBuilderExtension/RequestConverterText.kt b/ktorfit-ksp/src/main/kotlin/de/jensklingenberg/ktorfit/reqBuilderExtension/RequestConverterText.kt index 5b340c3f1..7b6b4a281 100644 --- a/ktorfit-ksp/src/main/kotlin/de/jensklingenberg/ktorfit/reqBuilderExtension/RequestConverterText.kt +++ b/ktorfit-ksp/src/main/kotlin/de/jensklingenberg/ktorfit/reqBuilderExtension/RequestConverterText.kt @@ -11,12 +11,16 @@ fun FunSpec.Builder.addRequestConverterText(parameterDataList: List() }) { parameterDataList.map { parameter -> val requestTypeClassName = - parameter.annotations.filterIsInstance().first().requestType.toClassName() + parameter.annotations + .filterIsInstance() + .firstOrNull() + ?.requestType + ?.toClassName() if (parameter.hasAnnotation()) { this.addStatement( "val %L: %T = %L.convertParameterType(%L,%L::class,%T::class)", parameter.name, - requestTypeClassName, + requestTypeClassName!!, converterHelper.objectName, parameter.name, parameter.name, diff --git a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/RequestTypeTest.kt b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/RequestTypeTest.kt index 34a376b45..2e679f791 100644 --- a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/RequestTypeTest.kt +++ b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/RequestTypeTest.kt @@ -20,7 +20,7 @@ import de.jensklingenberg.ktorfit.http.* interface TestService { @GET("posts/{postId}/comments") - suspend fun test(@RequestType(Int::class) @Path("postId") postId: String): String + suspend fun test(@RequestType(Int::class) @Path("postId") postId: String, @Query("postId") testQuery: String): String } """, ) From 2dc20666648c018fd340087e254d995c2eea92f4 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Thu, 8 Aug 2024 19:21:17 +0200 Subject: [PATCH 2/3] Fix compile issue with RequestType and multiple parameters --- docs/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7b1dd343..6cb73fce9 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -13,6 +13,11 @@ Unreleased - #594 Endpoint with types from other module - #591 Ktorfit plugin doesn't include correct generate source if build directory changes #591 - Build with Ktor 2.3.12 +- RequestConverter causing compile error #621 + +ktorfit-ksp-2.0.0-1.0.24 - 2024-06-08 +======================================== +- Build with KSP 1.0.24 ktorfit-ksp-2.0.0-1.0.23 - 2024-07-14 ======================================== From b99a4688b1e3ff398255ae66c65a9b0c1d9876ff Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Thu, 8 Aug 2024 19:21:36 +0200 Subject: [PATCH 3/3] Fix compile issue with RequestType and multiple parameters --- docs/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6cb73fce9..8e97585a8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -13,7 +13,7 @@ Unreleased - #594 Endpoint with types from other module - #591 Ktorfit plugin doesn't include correct generate source if build directory changes #591 - Build with Ktor 2.3.12 -- RequestConverter causing compile error #621 +- #621 RequestConverter causing compile error ktorfit-ksp-2.0.0-1.0.24 - 2024-06-08 ========================================