WIP: Add Serialize/Deserialize for ActiveValue #1631
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Serialize/Deserialize for ActiveValue
PR Info
As of right now there exists "with-json" feature flag, which allows applying changes to an ActiveModel through the JSON Value type. This could be useful when updating some data in the database by sending a JSON to the server through an HTTP API. An alternative way of doing the same thing would be to send the ActiveModel, with all its changes relative tp the Model, directly to the server. This requires the serialization of the ActiveModel. At the moment (sea-orm version 0.11) it is not possible due to Serialize/Deserialize traits not being implemented for ActiveValue. This PR adds the derive for these traits conditionally when the "with-json" feature is enabled. This way the Serialize/Deserialize traits implementation for the exact ActiveModel could be done by the library user, while the implementation for the ActiveValue is behind the feature flag.
New Features
Breaking Changes
Changes