Module aws_lambda_powertools.utilities.idempotency.serialization.functions

Functions

def get_actual_type(model_type: Any) ‑> Any

Extract the actual type from a potentially Optional or Union type. This function handles types that may be wrapped in Optional or Union, including the Python 3.10+ Union syntax (Type | None). Parameters


model_type : Any
The type to analyze. Can be a simple type, Optional[Type], BaseModel, dataclass

Returns

The actual type without Optional or Union wrappers.

Raises

IdempotencyModelTypeError
If the type specification is invalid (e.g., Union with multiple non-None types).