Recursively serialize the relationship object(s). Args: value: The value to serialize. Returns: The serialized value.
(cls, value)
| 75 | |
| 76 | @classmethod |
| 77 | def _dict_recursive(cls, value): |
| 78 | """Recursively serialize the relationship object(s). |
| 79 | Args: |
| 80 | value: The value to serialize. |
| 81 | |
| 82 | Returns: |
| 83 | The serialized value. |
| 84 | """ |
| 85 | if hasattr(value, "dict"): |
| 86 | return value.dict() |
| 87 | elif isinstance(value, list): |
| 88 | return [cls._dict_recursive(item) for item in value] |
| 89 | return value |
| 90 | |
| 91 | def dict(self, **kwargs): |
| 92 | """Convert the object to a dictionary. |