@@ -231,6 +231,7 @@ def Field(
231231 allow_mutation : bool = True ,
232232 regex : Optional [str ] = None ,
233233 discriminator : Optional [str ] = None ,
234+ validate_default : Optional [bool ] = None ,
234235 repr : bool = True ,
235236 primary_key : Union [bool , UndefinedType ] = Undefined ,
236237 foreign_key : Any = Undefined ,
@@ -275,6 +276,7 @@ def Field(
275276 allow_mutation : bool = True ,
276277 regex : Optional [str ] = None ,
277278 discriminator : Optional [str ] = None ,
279+ validate_default : Optional [bool ] = None ,
278280 repr : bool = True ,
279281 primary_key : Union [bool , UndefinedType ] = Undefined ,
280282 foreign_key : str ,
@@ -328,6 +330,7 @@ def Field(
328330 allow_mutation : bool = True ,
329331 regex : Optional [str ] = None ,
330332 discriminator : Optional [str ] = None ,
333+ validate_default : Optional [bool ] = None ,
331334 repr : bool = True ,
332335 sa_column : Union [Column [Any ], UndefinedType ] = Undefined ,
333336 schema_extra : Optional [dict [str , Any ]] = None ,
@@ -362,6 +365,7 @@ def Field(
362365 allow_mutation : bool = True ,
363366 regex : Optional [str ] = None ,
364367 discriminator : Optional [str ] = None ,
368+ validate_default : Optional [bool ] = None ,
365369 repr : bool = True ,
366370 primary_key : Union [bool , UndefinedType ] = Undefined ,
367371 foreign_key : Any = Undefined ,
@@ -377,7 +381,10 @@ def Field(
377381) -> Any :
378382 current_schema_extra = schema_extra or {}
379383
380- for param_name in ("coerce_numbers_to_str" ,):
384+ for param_name in (
385+ "coerce_numbers_to_str" ,
386+ "validate_default" ,
387+ ):
381388 if param_name in current_schema_extra :
382389 msg = f"Pass `{ param_name } ` parameter directly to Field instead of passing it via `schema_extra`"
383390 warnings .warn (msg , UserWarning , stacklevel = 2 )
@@ -388,6 +395,9 @@ def Field(
388395 current_coerce_numbers_to_str = coerce_numbers_to_str or current_schema_extra .pop (
389396 "coerce_numbers_to_str" , None
390397 )
398+ current_validate_default = validate_default or current_schema_extra .pop (
399+ "validate_default" , None
400+ )
391401 field_info_kwargs = {
392402 "alias" : alias ,
393403 "title" : title ,
@@ -396,6 +406,7 @@ def Field(
396406 "include" : include ,
397407 "const" : const ,
398408 "coerce_numbers_to_str" : current_coerce_numbers_to_str ,
409+ "validate_default" : current_validate_default ,
399410 "gt" : gt ,
400411 "ge" : ge ,
401412 "lt" : lt ,
0 commit comments