Skip to content

Commit a87f8c5

Browse files
author
Julian Vanden Broeck
committed
Match return type of SerializationInfo.mode() to mode of model_dump()
Pydantic in some place use Literal['python', 'json'] | str the serialization mode, using a more restrictive type can break stuff (e.g. typing validation). So this commit adapt the return type to make it matches with other pydantic valid serialization mode.
1 parent 04b296b commit a87f8c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/pydantic_core/core_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def context(self) -> ContextT:
145145
...
146146

147147
@property
148-
def mode(self) -> Literal['python', 'json']:
148+
def mode(self) -> Literal['python', 'json'] | str:
149149
"""The serialization mode set during serialization."""
150150
...
151151

0 commit comments

Comments
 (0)