From 23d14e620b9c656001f8283d14a3f7ccb728bb9b Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Wed, 27 Sep 2023 20:31:24 +0200 Subject: [PATCH] API: Serialize timedeltas as numbers The default has been changed in Pydantic V2. Fixes: #929 Signed-off-by: Nils Philippsen --- duffy/api_models/tenant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/duffy/api_models/tenant.py b/duffy/api_models/tenant.py index 62a00790..9730a532 100644 --- a/duffy/api_models/tenant.py +++ b/duffy/api_models/tenant.py @@ -19,7 +19,7 @@ class TenantBase(BaseModel, ABC): node_quota: Optional[Annotated[int, Field(gt=0)]] = None session_lifetime: Optional[ConfigTimeDelta] = None session_lifetime_max: Optional[ConfigTimeDelta] = None - model_config = ConfigDict(from_attributes=True) + model_config = ConfigDict(from_attributes=True, ser_json_timedelta="float") class TenantCreateModel(TenantBase):