Using Kotlin serialization with a multiplatform project. Data looks good till it is caught by the rest controller. When the data comes back to the server all of the data that is part of the DataTransportObject abstract class is the default data. When I debug it on the JS side before sending to rest service it looks perfect
here is my abstract class:
@Serializable
abstract class DataTransportObject(
open var id: Int = 0,
open var dateCreated: DateTime? = DateTime(),
open var dateUpdated: DateTime? = DateTime()
)
here is the class using it
@Serializable
data class BlogPostDto (override var id:Int, override var dateCreated: DateTime?, override var dateUpdated: DateTime?): DataTransportObject( id, dateCreated,dateUpdated){
var title:String = ""
var description:String = ""
var content:String = ""
var secRoleDetailAuthor:DtoMin = DtoMin(0,DateTime(),DateTime())
}
@PostMapping("/{id}")
fun update(@PathVariable id: Long, @RequestBody dto: CommentDto): CommentDto {
var adjustedDto = dto
dto.id = id.toInt()
val response: UpdateComment.Response = updateComment.update(UpdateComment.Request(adjustedDto))
when(response){
is UpdateComment.Response.Success -> return response.dto
is UpdateComment.Response.Failure -> throw RestUpdateFailureException(clazz = "Comment", msg = response.errMsg)
}
}
client side when i console out the dto being sent id/dateCreated/dateUpdated is correct. On the server side the id, dateCreated and dateUpdated are all the default values.
Any ideas?