use same serializer for reads as writes
Signed-off-by: fergusean [email protected]
Summary of changes
When creating a custom class to support database features and registering a serializer and deserializer, it seems the base SQL adapter uses a different registry for serialization (adapter.platform.serializer.serializerRegistry) to the database than it does for deserialization from the database (sqlSerializer.deserializerRegistry). This PR aligns them to use the same.
Relinquishment of Rights
Please mark following checkbox to confirm that you relinquish all rights of your changes:
- [X] I waive and relinquish all rights regarding this changes (including code, text, and images) to Deepkit UG (limited), Germany. This changes (including code, text, and images) are under MIT license without name attribution, copyright notice, and permission notice requirement.
Codecov Report
Merging #324 (5d6e43a) into master (b45ede8) will decrease coverage by
0.29%. The diff coverage isn/a.
:exclamation: Current head 5d6e43a differs from pull request most recent head e1789a0. Consider uploading reports for the commit e1789a0 to get more accurate results
@@ Coverage Diff @@
## master #324 +/- ##
==========================================
- Coverage 78.31% 78.01% -0.30%
==========================================
Files 169 164 -5
Lines 17672 17118 -554
Branches 4615 4492 -123
==========================================
- Hits 13839 13354 -485
+ Misses 3833 3764 -69
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
So this is interesting... moderation is a JSON string stored in SQLite. When I apply this PR, SQLite's boolean deserializer kicks in on not only SQLite's properties, but also the properties of the parsed JSON from the moderation field.
I would think for databases, JSON parsed objects should use the base deserializer, rather than the SQL platform's serializer, since root properties may be transformed in special ways (in/out of the DB driver) that would not apply to subobjects (such as embedded JSON).
Thoughts?
Oh, good catch, yes that's right! JSON fields should not use the database serializer.
@fergusean fixed in https://github.com/deepkit/deepkit-framework/commit/e5bf873381eff60af5c3c62132276695a79d9c5c
sweet thanks!!