[FEATURE] Enhanced Recursive Type Conversion for DCEvent #42
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.
Release Notes - Version 4.6.3
🎉 New Features
Enhanced Recursive Type Conversion for DCEvent
This release introduces significant improvements to the
DCEvent.from_dict()andDCEvent.to_dict()methods by integrating thedataclass-wizardlibrary. This enhancement provides robust recursive type conversion for complex nested data structures.Key Improvements:
Automatic Type Conversion:
DCEvent.from_dict()now automatically converts:uuid.UUIDobjectsdatetime.datetimeobjectsDCEventdataclass instancesImproved Serialization:
DCEvent.to_dict()now usesdataclass-wizard'sasdict()for better handling of nested structures and type serialization.Supported Conversions:
✅ UUID Conversion
uuid.UUIDobjects✅ Datetime Conversion
datetime.datetimeobjects✅ Nested Dataclasses
DCEventinstancesDCDomainEventandDCNotificationEvent✅ Collections
Example Usage:
📦 Dependencies
dataclass-wizard==0.*- Provides recursive type conversion capabilities🧪 Testing
Comprehensive test coverage has been added with over 600 lines of tests covering:
🔧 Technical Details
Changed Methods:
DCEvent.from_dict(): Now usesfromdict()fromdataclass-wizardinstead of direct dataclass instantiationDCEvent.to_dict(): Now usesasdict()fromdataclass-wizardinstead ofdataclasses.asdict()Backward Compatibility:
✅ Fully backward compatible - All existing code continues to work without changes. The new functionality enhances type conversion but maintains the same API.
📝 Migration Guide
No migration required! This is a drop-in enhancement. However, you can now take advantage of automatic type conversion:
Before (still works):
After (new capability):
🐛 Bug Fixes
from_dict()methodto_dict()method