saveourtool / save-cloud

Cluster-based cloud mechanism for running SAVE framework
https://cosv.gitlink.org.cn
MIT License
38 stars 3 forks source link

Move to kotlinx.serialization #908

Open icemachined opened 2 years ago

icemachined commented 2 years ago

Need to use kotlinx.serialization where possible instead of jakson ObjectMapper.

The problem that if i add libs.kotlinx.serialization.json dependency to backend, spring treat kotlinx as default serializer for classes marked as @Serializable and we have the following exception kotlinx.serialization.SerializationException: Serializer for class 'LocalDateTime' is not found. for Organization class.

we have example of handling it in orchestrator and backend projects see LocalDateTimeConfig. need also to separate kotlin part in serializable dto and java part in entity.

petertrr commented 2 years ago

Depends on #363#527 because of LocalDateTime

petertrr commented 2 years ago

Another point - we have to use Jackson for dates now in JVM services, because if we use kotlinx.datetime.LocalDateTime in common classes, Jackson will serialize them using reflection as a set of fields, while frontend expects ISO-formatted string. Can be solved by mixins, but will automatically get fixed once we move to kx.serizliation

petertrr commented 2 years ago

Turns out, jackson appears on the classpath also as a transitive dependency of springdoc-openapi. Probably, Jackson can be excluded from Spring by disabling JacksonAutoConfiguration