class documentation

Payload converter for payloads containing pydantic model instances.

JSON conversion is replaced with a converter that uses PydanticJSONPlainPayloadConverter.

Method __init__ Initialize object.

Inherited from CompositePayloadConverter:

Method from_payloads Decode values trying each converter.
Method get_converters_with_context Return converter instances with context set.
Method to_payloads Encode values trying each converter.
Method with_context Return a new instance with context set on the component converters.
Instance Variable converters List of payload converters to delegate to, in order.
Method _set_converters Undocumented
Property _any_converter_takes_context Undocumented

Inherited from PayloadConverter (via CompositePayloadConverter):

Method from_payload Convert a single payload to a value.
Method from_payloads_wrapper from_payloads for the temporalio.api.common.v1.Payloads wrapper.
Method to_payload Convert a single value to a payload.
Method to_payloads_wrapper to_payloads for the temporalio.api.common.v1.Payloads wrapper.
Class Variable default Default payload converter.
def __init__(self, to_json_options: ToJsonOptions | None = None, *, max_cached_type_adapters: int | None = 1024): (source) ΒΆ

Initialize object.

Parameters
to_json_options:ToJsonOptions | NoneOptions for serializing values to JSON.
max_cached_type_adapters:int | None

Maximum number of type adapters to cache, with least-recently-used eviction. Defaults to 1024. If None, the cache is unbounded. If zero, caching is disabled.

To configure this through a DataConverter, use a nullary subclass as the payload converter class:

class MyPayloadConverter(PydanticPayloadConverter):
    def __init__(self) -> None:
        super().__init__(max_cached_type_adapters=128)

my_data_converter = DataConverter(
    payload_converter_class=MyPayloadConverter
)