julee.util.repos.temporal.data_converter¶
Custom Temporal data converter with support for temporal_validation context.
This module provides a custom Pydantic data converter that automatically adds temporal_validation=True context when deserializing Pydantic models. This allows domain models to implement context-aware validation that can be more permissive during Temporal serialization/deserialization.
Attributes¶
Default Temporal data converter with temporal_validation context support. |
Classes¶
Custom payload converter that uses temporal validation context. |
|
Custom Pydantic JSON converter that adds temporal_validation context. |
Functions¶
|
Create a data converter with temporal validation support. |
Module Contents¶
- class julee.util.repos.temporal.data_converter.TemporalValidationPayloadConverter(to_json_options=None)[source]¶
Bases:
temporalio.converter.CompositePayloadConverterCustom payload converter that uses temporal validation context.
This payload converter extends CompositePayloadConverter to use our custom TemporalValidationPydanticConverter for JSON serialization, ensuring all Pydantic models get temporal_validation context.
- class julee.util.repos.temporal.data_converter.TemporalValidationPydanticConverter(to_json_options=None)[source]¶
Bases:
temporalio.contrib.pydantic.PydanticJSONPlainPayloadConverterCustom Pydantic JSON converter that adds temporal_validation context.
This converter extends the standard PydanticJSONPlainPayloadConverter to automatically add temporal_validation=True context when deserializing Pydantic models. This allows domain models to implement more permissive validation during Temporal operations while maintaining strict validation for direct instantiation.
- from_payload(payload, type_hint=None)[source]¶
Deserialize payload with temporal_validation context.
This method overrides the base implementation to always add temporal_validation=True to the validation context. This allows Pydantic models to detect when they’re being deserialized by Temporal and apply appropriate validation rules.
- Parameters:
payload (temporalio.api.common.v1.Payload) – The Temporal payload to deserialize
type_hint (type | None) – Optional type hint for the expected return type
- Returns:
Deserialized object with temporal validation context applied
- Return type:
Any
- julee.util.repos.temporal.data_converter.create_temporal_data_converter(to_json_options=None)[source]¶
Create a data converter with temporal validation support.
This factory function creates a DataConverter that uses our custom TemporalValidationPayloadConverter for serialization. This ensures that all Pydantic models are deserialized with the temporal_validation context.
- Parameters:
to_json_options (temporalio.contrib.pydantic.ToJsonOptions | None) – Optional configuration for JSON serialization
- Returns:
DataConverter configured with temporal validation support
- Return type:
temporalio.converter.DataConverter
- julee.util.repos.temporal.data_converter.temporal_data_converter[source]¶
Default Temporal data converter with temporal_validation context support.
This data converter automatically adds temporal_validation=True context when deserializing Pydantic models, allowing domain models to implement context-aware validation rules.
- Usage:
- client = Client(
data_converter=temporal_data_converter, …
)