ribesg
12/16/2021, 4:49 PM/* In a module of a KMP library */
@Serializable
internal data class GetFileResponse(
val url: String
)
// In the same module
override suspend fun getFileUrl(fileId: FileId): String =
http.get<GetFileResponse>("$baseUrl$file/$fileId") {
useAuthentication()
}.url
/* In an iOS app using the aforementioned library */
val url = try {
fileApi.getFileUrl(fileId)
} catch(t: Throwable) {
log.error("Failed to get file url for file id $fileId: ${t.message}", t)
return null
}
/* Logs when running */
ERROR - Failed to get file url for file id blablabla: Fields [name, rating] are required for type with serial name 'whatever.whatever.internal.model.UpsertCandidateEvaluationPayload.CriteriaValue', but they were missing
kotlinx.serialization.MissingFieldException: Fields [name, rating] are required for type with serial name 'whatever.whatever.internal.model.UpsertCandidateEvaluationPayload.CriteriaValue', but they were missing
The model mentioned by the log is completely unrelated and defined in a completely different place in another dependency… wat
I just updated to 1.6.0 then 1.6.10 from 1.5.31 so maybe it’s that I don’t know. Super weird bug and not sure what to do. Is it some kind of name/id/hashcode clash or something?ribesg
12/16/2021, 5:06 PMoverride suspend fun getFileUrl(fileId: FileId): String =
http.get<JsonObject>("$baseUrl$file/$fileId") {
useAuthentication()
}.getValue("url").jsonPrimitive.content