arrow-exact icon indicating copy to clipboard operation
arrow-exact copied to clipboard

KotlinX.Serialization interop

Open CLOVIS-AI opened this issue 1 year ago • 0 comments

KotlinX.Serialization has a great serialization story with regular Kotlin:

@Serializable
class Foo(
    val username: String,
) {
    init {
        ensure(' ' !in username) { "The username cannot contain whitespace" }
    }
}

If we follow the same approach of "just annotate it with @Serializable", with our current design, it will be possible to deserialize values that are not valid.

I don't really see a good way to do this at the moment, I'm interested if you have any ideas.

CLOVIS-AI avatar May 20 '23 21:05 CLOVIS-AI