I want to fetch XML data from API and map it to Kotlin model object by using Retrofit2 + SimpleXML in Kotlin.
However, I got such as the following error message from
This is the same problem as: kotlin data class + bean validation jsr 303
You need to use Annotation use-site targets since the default for an annotation on a property is prioritized as:
Use get or set target to place the annotation on the getter or setter. Here it is for the getter:
@Root(name = "response")
public class User() {
@get:Element public var result: String? = null
@get:Element public var token: String? = null
@get:Element public var uid: String? = null
}
See the linked answer for the details.