Fix issue where custom JSOn serializer generates Base64 encoded data in state store#504
Conversation
…er. Refactor DaprStateAsyncprovider class to use custom serializers based on ObjectSerializer class as Json serializer. Add unit tests.
|
Please, use the DaprObjectSerializer interface to bring your own serializer. The default serializer is just for examples and getting started. |
|
Please, focus on fixing the issue where a custom JSON serializer becomes Base64 encoded. Making DefaultObjectSerializer is a controversial change since it is not supposed to be used outside examples or getting started with Dapr. |
Ok. I will revert changes with ObjectSerializer and focused on the issue. Thanks for your feedback. |
Codecov Report
@@ Coverage Diff @@
## master #504 +/- ##
=========================================
Coverage 80.43% 80.43%
+ Complexity 975 974 -1
=========================================
Files 88 88
Lines 3015 3015
Branches 331 330 -1
=========================================
Hits 2425 2425
Misses 424 424
Partials 166 166
Continue to review full report at Codecov.
|
| this.daprClient = daprClient; | ||
| this.stateSerializer = stateSerializer; | ||
| this.isStateSerializerDefault = stateSerializer.getClass() == DefaultObjectSerializer.class; | ||
| this.isStateSerializerJson = JSON_CONTENT_TYPE.equals(stateSerializer.getContentType()); |
There was a problem hiding this comment.
We can make this check even more extensible by having a deeper understanding of different media types. This change is already an important improvement.
Merge pull request #504 from abogdanov37/feature_fix-statestore-seria…
Description
Refactor ObjectSerializer class to add ability set custom object mapper.
Refactor DaprStateAsyncprovider class to use custom serializers based on ObjectSerializer class as Json serializer.
Add unit tests.
Issue reference
#503
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: