<Elegant way to validate multiple properties are n...
# stackoverflow
r
Elegant way to validate multiple properties are non-null and report errors in Kotlin? Given that I have an API model where all fields are nullable and a corresponding domain model where all fields are required: data class MyApiModel( val property1: Int?, val property2: String?, val property3: Boolean?, ) data class MyDomainModel( val property1: Int, val property2: String, val property3: Boolean, ) I want to write a mapping function that will convert an instance of the API model to the domain model, validating that all of the field are non-null. I want...