Skip to content

Commit 78ac0a3

Browse files
🐛 Fix serialization of mongo_object_id (#302)
* Update mongo_object_id.py * Update mongo_object_id.py
1 parent 889319b commit 78ac0a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: pydantic_extra_types/mongo_object_id.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __get_pydantic_core_schema__(cls, _: Any, __: GetCoreSchemaHandler) -> core_
5757
),
5858
]
5959
),
60-
serialization=core_schema.plain_serializer_function_ser_schema(lambda x: str(x)),
60+
serialization=core_schema.plain_serializer_function_ser_schema(lambda x: str(x), when_used='json'),
6161
)
6262

6363
@classmethod

0 commit comments

Comments
 (0)