Skip to content

Commit

Permalink
release v1.3.0 (#295)
Browse files Browse the repository at this point in the history
* release v1.3.0
  • Loading branch information
Foso authored May 14, 2023
1 parent 3ec4451 commit ba0d6ca
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Please see the documentation at [https://foso.github.io/Ktorfit/](https://foso.g

| Version | Kotlin | KSP | Ktor |
|--------------|:----------:|:----------:|:---------:|
| **_latest_** | **1.8.20** | **1.0.10** | **2.3.0** |
| **_latest_** | **1.8.20** | **1.0.11** | **2.3.0** |
| **_1.2.0_** | **1.8.20** | **1.0.10** | **2.3.0** |
| **_1.1.0_** | **1.8.20** | **1.0.10** | **2.2.4** |

# Release
Expand Down
23 changes: 23 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,35 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Removed

### Fixed

### Security

### Bumped

1.3.0 - 2023-05-14
========================================

### Added

### Changed
* Optimized generated code, the generated code that is used for a request will
now directly set the Ktor code instead of delegating it to a Ktorfit class. This will
make the code easier to understand.

* KSP version 1.0.11 is now needed

### Deprecated

### Removed

### Fixed
[Bug]: IllegalArgumentException with Custom Http Annotation #274

### Security

### Bumped
KSP version to 1.0.11

1.2.0 - 2023-05-05
========================================
Expand Down
2 changes: 1 addition & 1 deletion example/AndroidOnlyExample/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id ("de.jensklingenberg.ktorfit") version "1.0.0"

}
val ktorfit = "1.2.0"
val ktorfit = "1.3.0"

configure<de.jensklingenberg.ktorfit.gradle.KtorfitGradleConfiguration> {
version = ktorfit
Expand Down
2 changes: 1 addition & 1 deletion example/AndroidOnlyExample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.1' apply false
id 'com.android.application' version '8.0.0-alpha09' apply false
id 'com.android.library' version '8.0.0-alpha09' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}
4 changes: 2 additions & 2 deletions example/MultiplatformExample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("com.google.devtools.ksp") version "1.8.20-1.0.10"
id("com.google.devtools.ksp") version "1.8.20-1.0.11"
id("kotlinx-serialization")
id("de.jensklingenberg.ktorfit") version "1.0.0"
}

version = "1.0"
val ktorVersion = "2.3.0"
val ktorfitVersion = "1.2.0"
val ktorfitVersion = "1.3.0"

configure<de.jensklingenberg.ktorfit.gradle.KtorfitGradleConfiguration> {
version = ktorfitVersion
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ detekt = "1.22.0"
kctfork = "0.2.1"
kotlin = "1.8.20"
kotlinPoet = "1.13.2"
kspVersion = "1.8.20-1.0.10"
ktorfit = "1.2.0"
ktorfit-lib = "1.1.0"
kspVersion = "1.8.20-1.0.11"
ktorfit = "1.3.0"
ktorfit-lib = "1.3.0"
ktorVersion = "2.3.0"
dokkaVersion = "1.8.10"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ fun getUrlCode(params: List<ParameterData>, methodAnnotation: HttpMethodAnnotati
params.filter { it.hasAnnotation<Path>() }.forEach { parameterData ->
val paramName = parameterData.name
val pathAnnotation = parameterData.findAnnotationOrNull<Path>()!!

val pathEncoded = if (!pathAnnotation.encoded) {
".encodeURLPath()"
} else {
""
}
urlPath = urlPath.replace("{$paramName}", "\${\"\$${paramName}\"$pathEncoded}")
urlPath = urlPath.replace("{${pathAnnotation.value}}", "\${\"\$${paramName}\"$pathEncoded}")
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ import de.jensklingenberg.ktorfit.http.Path
interface TestService {
@GET("user/{id}")
suspend fun test(@Path("id") id: String): String
suspend fun test(@Path("id") userId: String): String
}
"""
)


val expectedFunctionText = """url(ktorfitClient.baseUrl + "user/ä{"äid".encodeURLPath()}") """.replace("ä","$")
val expectedFunctionText = """url(ktorfitClient.baseUrl + "user/ä{"äuserId".encodeURLPath()}")""".replace("ä","$")

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class UrlArgumentTextKtTest {
val parameterData =
ParameterData("test1", ReturnTypeData("String", "kotlin.String", null), annotations = listOf(path))
val params = listOf(parameterData)
val text = getUrlCode(params,HttpMethodAnnotation("user/{test1}",HttpMethod.GET))
val text = getUrlCode(params,HttpMethodAnnotation("user/{testValue}",HttpMethod.GET))
Assert.assertEquals("""url(ktorfitClient.baseUrl + "user/ä{"ätest1".encodeURLPath()}")""".replace("ä","$"), text)
}
}

0 comments on commit ba0d6ca

Please sign in to comment.