form-conductor icon indicating copy to clipboard operation
form-conductor copied to clipboard

Incompatible with kotlinx-serialization

Open bwmgd opened this issue 3 years ago • 4 comments

import com.boe.itc.b4client.utlis.Required
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import me.naingaungluu.formconductor.annotations.Form

@Form
@Serializable
data class User(
    @SerialName("userId")
    @Required("User ID is required")
    val userName: String = "",
    @SerialName("password")
    @Required("Password is required")
    val password: String = ""
)

Use kotlinx-serialization will report errors

java.lang.IllegalArgumentException: Form data class 'User' needs to have a default constructor parameters.
                 Following parameters need to have a default value in the constructor:
                 [seen1, userName, password, serializationConstructorMarker]

bwmgd avatar Jan 18 '23 09:01 bwmgd

Use moshi is OK, But still hope to support kotlinx-serialization

bwmgd avatar Jan 18 '23 09:01 bwmgd

@bwmgd It must be due to the way kotlinx-serialization is generating the constructors. I'll look into it and give you an update!

NaingAungLuu avatar Jan 18 '23 11:01 NaingAungLuu

Thank you very much, it's a great library. Hope to keep updating it.

bwmgd avatar Jan 19 '23 02:01 bwmgd