NaingAungLuu / form-conductor

A declarative form validation for Jetpack Compose
https://formconductor.naingaungluu.me
MIT License
64 stars 5 forks source link

Incompatible with kotlinx-serialization #44

Open bwmgd opened 1 year ago

bwmgd commented 1 year ago
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 commented 1 year ago

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

NaingAungLuu commented 1 year ago

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

bwmgd commented 1 year ago

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