Skip to content

Commit 5b64e8e

Browse files
fix serialization
1 parent a0cf317 commit 5b64e8e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/common-library/src/common_library/serialization.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from datetime import timedelta
22
from typing import Any
33

4-
from common_library.pydantic_fields_extension import get_type
5-
from pydantic import BaseModel, SecretStr
4+
from pydantic import BaseModel, SecretStr, TypeAdapter
65
from pydantic_core import Url
76

87

@@ -29,10 +28,10 @@ def model_dump_with_secrets(
2928
data[field_name] = str(field_data)
3029

3130
elif isinstance(field_data, dict):
32-
field_type = get_type(settings_obj.model_fields[field_name])
33-
if field_type and issubclass(field_type, BaseModel):
31+
field_type = settings_obj.model_fields[field_name].annotation
32+
if field_type:
3433
data[field_name] = model_dump_with_secrets(
35-
field_type.model_validate(field_data),
34+
TypeAdapter(field_type).validate_python(field_data),
3635
show_secrets=show_secrets,
3736
**pydantic_export_options,
3837
)

0 commit comments

Comments
 (0)