Christian Lippka
09/26/2022, 9:51 PMimport kotlinx.serialization.Serializable
@Serializable
abstract class TagsDto( val id: String?, val name: String, val icon: String?, val color: String? )
@Serializable
class LocationTagsDto( id: String? = null, name: String, icon: String?, color: String? )
: TagsDto( id = id, name = name, icon = icon, color = color)
This fails compilation on the second @Serializable
This class is not serializable automatically because it has primary constructor parameters that are not propertiesI don’t want to have
LocationTagsDto
add any new property to TagsDto
. How can I make this work? Thanks in advance.hfhbd
09/26/2022, 10:54 PMimport kotlinx.serialization.Serializable
@Serializable
abstract class TagsDto {
abstract val id: String?
abstract val name: String
abstract val icon: String?
abstract val color: String?
}
@Serializable
data class LocationTagsDto(
override val id: String? = null,
override val name: String,
override val icon: String?,
override val color: String?
) : TagsDto()
Christian Lippka
09/27/2022, 11:53 AM