@@ -109,7 +109,8 @@ def __dataclass_transform__(
109
109
return lambda a : a
110
110
111
111
112
- class FieldInfo (PydanticFieldInfo ):
112
+ class FieldInfo (PydanticFieldInfo ): # type: ignore[misc]
113
+ # mypy - ignore that PydanticFieldInfo is @final
113
114
def __init__ (self , default : Any = Undefined , ** kwargs : Any ) -> None :
114
115
primary_key = kwargs .pop ("primary_key" , False )
115
116
nullable = kwargs .pop ("nullable" , Undefined )
@@ -863,27 +864,27 @@ def model_dump(
863
864
mode : Union [Literal ["json" , "python" ], str ] = "python" ,
864
865
include : Union [IncEx , None ] = None ,
865
866
exclude : Union [IncEx , None ] = None ,
866
- context : Union [Any , None ] = None ,
867
+ context : Union [Any , None ] = None , # v2.7
867
868
by_alias : Union [bool , None ] = None ,
868
869
exclude_unset : bool = False ,
869
870
exclude_defaults : bool = False ,
870
871
exclude_none : bool = False ,
872
+ exclude_computed_fields : bool = False , # v2.12
871
873
round_trip : bool = False ,
872
874
warnings : Union [bool , Literal ["none" , "warn" , "error" ]] = True ,
873
- fallback : Union [Callable [[Any ], Any ], None ] = None ,
874
- serialize_as_any : bool = False ,
875
+ fallback : Union [Callable [[Any ], Any ], None ] = None , # v2.11
876
+ serialize_as_any : bool = False , # v2.7
875
877
) -> Dict [str , Any ]:
876
878
if PYDANTIC_MINOR_VERSION < (2 , 11 ):
877
879
by_alias = by_alias or False
880
+ extra_kwargs : Dict [str , Any ] = {}
878
881
if PYDANTIC_MINOR_VERSION >= (2 , 7 ):
879
- extra_kwargs : Dict [str , Any ] = {
880
- "context" : context ,
881
- "serialize_as_any" : serialize_as_any ,
882
- }
882
+ extra_kwargs ["context" ] = context
883
+ extra_kwargs ["serialize_as_any" ] = serialize_as_any
883
884
if PYDANTIC_MINOR_VERSION >= (2 , 11 ):
884
885
extra_kwargs ["fallback" ] = fallback
885
- else :
886
- extra_kwargs = {}
886
+ if PYDANTIC_MINOR_VERSION >= ( 2 , 12 ) :
887
+ extra_kwargs [ "exclude_computed_fields" ] = exclude_computed_fields
887
888
if IS_PYDANTIC_V2 :
888
889
return super ().model_dump (
889
890
mode = mode ,
0 commit comments