55replacing Dict[str, Any] returns with appropriate type safety.
66"""
77
8- from datetime import datetime
8+ from datetime import datetime , timezone
99from typing import Any , Optional
1010
1111from pydantic import Field
@@ -128,7 +128,8 @@ class ConfigurationSectionResponse(BaseDTO):
128128 default_factory = list , description = "List of providers that failed validation"
129129 )
130130 validation_timestamp : datetime = Field (
131- default_factory = datetime .utcnow , description = "When validation was performed"
131+ default_factory = lambda : datetime .now (timezone .utc ),
132+ description = "When validation was performed" ,
132133 )
133134
134135
@@ -146,7 +147,8 @@ class SystemStatusDTO(BaseDTO):
146147 cpu_usage_percent : float = Field (description = "CPU usage percentage" )
147148 disk_usage_percent : float = Field (description = "Disk usage percentage" )
148149 last_health_check : datetime = Field (
149- default_factory = datetime .utcnow , description = "Last health check timestamp"
150+ default_factory = lambda : datetime .now (timezone .utc ),
151+ description = "Last health check timestamp" ,
150152 )
151153 components : dict [str , str ] = Field (
152154 default_factory = dict , description = "Status of individual components"
@@ -167,7 +169,8 @@ class ProviderMetricsDTO(BaseDTO):
167169 uptime_percent : float = Field (description = "Provider uptime percentage" )
168170 health_status : str = Field (description = "Current health status" )
169171 metrics_timestamp : datetime = Field (
170- default_factory = datetime .utcnow , description = "When metrics were collected"
172+ default_factory = lambda : datetime .now (timezone .utc ),
173+ description = "When metrics were collected" ,
171174 )
172175
173176
@@ -196,7 +199,7 @@ class ProviderCapabilitiesDTO(BaseDTO):
196199 supports_auto_scaling : bool = Field (description = "Whether auto scaling is supported" )
197200 api_version : str = Field (description = "API version" )
198201 last_updated : datetime = Field (
199- default_factory = datetime .utcnow , description = "Last update timestamp"
202+ default_factory = lambda : datetime .now ( timezone . utc ) , description = "Last update timestamp"
200203 )
201204
202205
@@ -214,7 +217,8 @@ class ProviderStrategyConfigDTO(BaseDTO):
214217 retry_attempts : int = Field (description = "Number of retry attempts" )
215218 timeout_seconds : int = Field (description = "Timeout in seconds" )
216219 last_modified : datetime = Field (
217- default_factory = datetime .utcnow , description = "Last modification timestamp"
220+ default_factory = lambda : datetime .now (timezone .utc ),
221+ description = "Last modification timestamp" ,
218222 )
219223
220224
@@ -228,6 +232,7 @@ class ValidationDTO(BaseDTO):
228232 warnings : list [str ] = Field (default_factory = list , description = "List of validation warnings" )
229233 template_id : str = Field (description = "ID of the validated template" )
230234 validation_timestamp : datetime = Field (
231- default_factory = datetime .utcnow , description = "When validation was performed"
235+ default_factory = lambda : datetime .now (timezone .utc ),
236+ description = "When validation was performed" ,
232237 )
233238 schema_version : str = Field (description = "Schema version used for validation" )
0 commit comments