You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can collect errors in some cases, but we want to stick to vanilla Kotlin. So we should create an requireAll variant, than can handle multiple require statements, but still throw IllegalStateException as expected by KotlinX Serialization, and Ktor.
All code below should be generated, this is purely an example/proposal. The final result may look completely different.
funrequireAll(varargvalidation:Pair<String, () -> Unit>) =TODO()
data classPerson(valname:String, valage:Int) {
init {
requireAll(
Pair("Name must be of length between x and y") { name.length in x..y },
Pair("Age must be between i and j") { age in i..j }
)
}
}
The text was updated successfully, but these errors were encountered:
We can collect errors in some cases, but we want to stick to vanilla Kotlin. So we should create an
requireAll
variant, than can handle multiple require statements, but still throwIllegalStateException
as expected by KotlinX Serialization, and Ktor.All code below should be generated, this is purely an example/proposal. The final result may look completely different.
The text was updated successfully, but these errors were encountered: