uranusjr commented on code in PR #59667: URL: https://github.com/apache/airflow/pull/59667#discussion_r2638581442
########## airflow-core/docs/authoring-and-scheduling/serializers.rst: ########## @@ -26,12 +26,20 @@ and efficiency. Serialization is a surprisingly hard job. Python out of the box only has support for serialization of primitives, like ``str`` and ``int`` and it loops over iterables. When things become more complex, custom serialization is required. -Airflow out of the box supports three ways of custom serialization. Primitives are returned as is, without -additional encoding, e.g. a ``str`` remains a ``str``. When it is not a primitive (or iterable thereof) Airflow -looks for a registered serializer and deserializer in the namespace of ``airflow.sdk.serde.serializers``. -If not found it will look in the class for a ``serialize()`` method or in case of deserialization a -``deserialize(data, version: int)`` method. Finally, if the class is either decorated with ``@dataclass`` -or ``@attr.define`` it will use the public methods for those decorators. +Airflow supports custom serialization using a well-defined resolution order: + +First, primitive values (such as ``str`` or ``int``) and iterables of primitives +are returned as-is, without additional encoding. + +If the object is not a primitive, Airflow looks for a registered serializer and +deserializer in the ``airflow.sdk.serde.serializers`` namespace. + +If no registered serializer is found, Airflow then checks whether the object +defines a ``serialize()`` method (and, for deserialization, a corresponding +``deserialize(data, version: int)`` method). + +Finally, if the object is decorated with ``@dataclass`` or ``@attr.define``, +Airflow serializes the object using the public fields provided by those decorators. Review Comment: This should probably be converted into a bullet or numbered list -- 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]
