-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from Q42/kotlinx-serialization
REPLACE Moshi by Kotlinx serialization
- Loading branch information
Showing
13 changed files
with
53 additions
and
129 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
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 was deleted.
Oops, something went wrong.
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,7 +1,12 @@ | ||
apply { | ||
plugin(libs.plugins.kotlinSerialization.get().getPluginId()) | ||
} | ||
|
||
dependencies { | ||
implementation libs.retrofit | ||
implementation libs.moshiRetrofitConverter | ||
implementation(libs.kotlinx.serialization.json) | ||
implementation libs.retrofit2.kotlinx.serialization.converter | ||
implementation libs.networkResponseAdapter | ||
implementation libs.okhttp | ||
implementation libs.okhttpLogging | ||
} | ||
} |
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
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
7 changes: 4 additions & 3 deletions
7
core/actionresult/src/main/kotlin/nl/q42/template/actionresult/data/ApiErrorResponse.kt
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,12 +1,13 @@ | ||
package nl.q42.template.actionresult.data | ||
|
||
import com.squareup.moshi.JsonClass | ||
import kotlinx.serialization.Serializable | ||
|
||
|
||
/** | ||
* ErrorResponse used by NetworkResponseAdapter. Config it to match your server's error | ||
* json structure. | ||
* | ||
* More info: https://haroldadmin.github.io/NetworkResponseAdapter/ | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class ApiErrorResponse(val message: String) | ||
@Serializable | ||
data class ApiErrorResponse(val message: String) |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ apply from: "$rootDir/build.dep.network.gradle" | |
|
||
android { | ||
namespace = "nl.q42.template.core.network" | ||
} | ||
} |
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
9 changes: 5 additions & 4 deletions
9
data/user/src/main/kotlin/nl/q42/template/data/user/remote/model/UserDTO.kt
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,18 +1,19 @@ | ||
package nl.q42.template.data.user.remote.model | ||
|
||
import com.squareup.moshi.JsonClass | ||
import kotlinx.serialization.Serializable | ||
|
||
|
||
/** | ||
* Data Transfer Models (DTO) are preferably generated from server source code/json/schemas and do not contain | ||
* any changes compared to the server contract. | ||
*/ | ||
|
||
@JsonClass(generateAdapter = true) | ||
@Serializable | ||
internal data class UserDTO( | ||
val args: ArgsDTO | ||
) | ||
|
||
@JsonClass(generateAdapter = true) | ||
@Serializable | ||
internal data class ArgsDTO( | ||
val email: String | ||
) | ||
) |
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