uranusjr commented on PR #26735:
URL: https://github.com/apache/airflow/pull/26735#issuecomment-1260364031
Something like this
```python
class MyAirflowPlugin(AirflowPlugin):
custom_serde = MyCustomSerialization()
class MyCustomSerialization:
def serialize(self, obj):
if isinstance(obj, MyObj):
return "MyObj", {"a": obj.a, "b": obj.get_b()}
def deserialize(self, type_, data):
if type_ == "MyObj":
return MyObj(a=data["a"], ...)
```
When the serializer encounters something it doesn’t recognise, it’d call the
custom serialiser. Similarly, if the serialised data contains a `__type` that’s
not in the known list, it calls the custom deserialiser to see if something can
be produced.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]