File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -395,17 +395,12 @@ def Field(
395395 current_schema_extra = schema_extra or {}
396396
397397 if regex :
398- warnings .warn (
399- REGEX_PARAM_DEPRECATION_MSG ,
400- DeprecationWarning ,
401- stacklevel = 2 ,
402- )
403- if "pattern" in current_schema_extra :
404- warnings .warn (
405- "Pass `pattern` parameter directly to Field instead of passing it via `schema_extra`" ,
406- DeprecationWarning ,
407- stacklevel = 2 ,
408- )
398+ warnings .warn (REGEX_PARAM_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
399+
400+ for param_name in ("pattern" ,):
401+ if param_name in current_schema_extra :
402+ msg = f"Pass `{ param_name } ` parameter directly to Field instead of passing it via `schema_extra`"
403+ warnings .warn (msg , UserWarning , stacklevel = 2 )
409404
410405 # Extract possible alias settings from schema_extra so we can control precedence
411406 schema_validation_alias = current_schema_extra .pop ("validation_alias" , None )
You can’t perform that action at this time.
0 commit comments