@@ -256,14 +256,15 @@ def model_dump(
256256            mode : Literal ["json" , "python" ] |  str  =  "python" ,
257257            include : IncEx  |  None  =  None ,
258258            exclude : IncEx  |  None  =  None ,
259-             by_alias : bool  =   False ,
259+             by_alias : bool  |   None   =   None ,
260260            exclude_unset : bool  =  False ,
261261            exclude_defaults : bool  =  False ,
262262            exclude_none : bool  =  False ,
263263            round_trip : bool  =  False ,
264264            warnings : bool  |  Literal ["none" , "warn" , "error" ] =  True ,
265265            context : dict [str , Any ] |  None  =  None ,
266266            serialize_as_any : bool  =  False ,
267+             fallback : Callable [[Any ], Any ] |  None  =  None ,
267268        ) ->  dict [str , Any ]:
268269            """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump 
269270
@@ -295,10 +296,12 @@ def model_dump(
295296                raise  ValueError ("context is only supported in Pydantic v2" )
296297            if  serialize_as_any  !=  False :
297298                raise  ValueError ("serialize_as_any is only supported in Pydantic v2" )
299+             if  fallback  is  not   None :
300+                 raise  ValueError ("fallback is only supported in Pydantic v2" )
298301            dumped  =  super ().dict (  # pyright: ignore[reportDeprecated] 
299302                include = include ,
300303                exclude = exclude ,
301-                 by_alias = by_alias ,
304+                 by_alias = by_alias   if   by_alias   is   not   None   else   False ,
302305                exclude_unset = exclude_unset ,
303306                exclude_defaults = exclude_defaults ,
304307                exclude_none = exclude_none ,
@@ -313,13 +316,14 @@ def model_dump_json(
313316            indent : int  |  None  =  None ,
314317            include : IncEx  |  None  =  None ,
315318            exclude : IncEx  |  None  =  None ,
316-             by_alias : bool  =   False ,
319+             by_alias : bool  |   None   =   None ,
317320            exclude_unset : bool  =  False ,
318321            exclude_defaults : bool  =  False ,
319322            exclude_none : bool  =  False ,
320323            round_trip : bool  =  False ,
321324            warnings : bool  |  Literal ["none" , "warn" , "error" ] =  True ,
322325            context : dict [str , Any ] |  None  =  None ,
326+             fallback : Callable [[Any ], Any ] |  None  =  None ,
323327            serialize_as_any : bool  =  False ,
324328        ) ->  str :
325329            """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json 
@@ -348,11 +352,13 @@ def model_dump_json(
348352                raise  ValueError ("context is only supported in Pydantic v2" )
349353            if  serialize_as_any  !=  False :
350354                raise  ValueError ("serialize_as_any is only supported in Pydantic v2" )
355+             if  fallback  is  not   None :
356+                 raise  ValueError ("fallback is only supported in Pydantic v2" )
351357            return  super ().json (  # type: ignore[reportDeprecated] 
352358                indent = indent ,
353359                include = include ,
354360                exclude = exclude ,
355-                 by_alias = by_alias ,
361+                 by_alias = by_alias   if   by_alias   is   not   None   else   False ,
356362                exclude_unset = exclude_unset ,
357363                exclude_defaults = exclude_defaults ,
358364                exclude_none = exclude_none ,
0 commit comments