import kotlinx.serialization.Serializable
@Serializable
sealed class Exercise(open val id: String) {
@Serializable
data class Theory(override val id: String) : Exercise(id)
}
I have such kind of sealed class in my code, and compiler says me:
Serializable class has duplicate serial name of property 'id', either in the class itself or its supertypes.
Is there way to have open val in serializable sealed class, which works correctly when overriding it?
data class Theory(id: String):Exercise(id)? - amaninclass Theory(id: String) : Exercise(id)instead, I have this error:This class is not serializable automatically because it has primary constructor parameters that are not properties- Bohdan Yevtushenko