diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7b1dd343..8e97585a8 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 +- #621 RequestConverter causing compile error + +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 ======================================== 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 } """, )