Why Declaring Only the Required Properties in Your Model is a Good Idea

As a developer working with REST APIs, you have likely encountered situations where you need to deserialize the response data from a web server. In Kotlin, the most common approach to deserialize response data is by defining a model class that mirrors the server’s response. While it may be tempting to declare all the properties that the server returns in your Kotlin model, it is not always the best approach. Yesterday, a customer reported to me that our app was crashing during login....

May 5, 2023 · 3 min