fix: serialize typing classes assigned to fields
We had a case where a function input used an lru_cache as attribute, not as a decorator, and lru_cache somewhere internally stores the return type of the function... and typing.Sequence for example has an attribute slots but that is None, so the serialization failed every time.
If someone has a better idea how to catch that or what types should be serialized to, I'd be glad to get input :)
Thanks!
[!IMPORTANT] Fix serialization of typing classes with
__slots__inEventSerializerand add corresponding test.
- Behavior:
- In
serializer.py,EventSerializer.default()now checks ifobjis a type or a generic alias and serializes it as"<obj.__name__>".- Handles cases where
__slots__isNoneto prevent serialization failures.- Tests:
- Adds
test_slots_types()intest_serializer.pyto verify serialization of typing classes assigned to fields.This description was created by
for 79a79c3ef20f6e1a783fbd9f8b9a695b9d9a445b. It will automatically update as commits are pushed.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Thanks again for raising this! Closing this as stale / no longer relevant in Python SDK v3. If you continue to see issues, please open a Github issue 👍🏾