-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change serialization strategy #123
Conversation
* Use kotlinx serializer for snapshots * Clean up * Change serialization strategy for deployment and protocol
c981ad8
to
ec086b3
Compare
src/main/kotlin/dk/cachet/carp/webservices/datastream/controller/DataStreamController.kt
Show resolved
Hide resolved
src/main/kotlin/dk/cachet/carp/webservices/datastream/service/core/CoreDataStreamService.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice - @RequestBody httpMessage: String, will accept .json content as string
I understand now why you're making thin layer of WS regarding to serializers;
this is to be merged, since I want to follow up on unit tests. unsure if @NGrech wants to review this or the talk we had about this change was sufficient |
Using Kotlinx json serializer instead of Jakson wrapper.
This avoid converting incoming http messages into
Jackson TreeNode
before usingcore Json serializer
.Error handling in
Jackson TreeNode
were redundant, sincekotlinx.serialization
is eventually used.Main changes:
ApplicationServiceRequest
endpoints, we treat incoming request asString
and usecarp.core
json serializer to decode and build the request object.carp.core
domain models, we use core serializers to encode them into json string.Snapshot
data saved in the database through core repository, core serialization is used to create the snapshot, butObjectMapper.readTree
is still used to createJsonb
values.ObjectMapper
is switched toJson
Reasons/Advantages:
kotlinx.serialization
, it's hard to maintain/keep track of which method to use.Other notes and TODOs:
Json
Bean is created for spring to autowire in some service classes, since current testing library need it to mock the value. We should consider to use this Bean for all occurrence, or import the object. (we are not changing the state of this serializer object, so I went with import object approach in the first place).Account
module is updated, since it also communicate with `Keycloak so more thoughts are needed here.