@@ -211,6 +211,13 @@ def add_condition(self, condition: BaseCondition) -> None:
211211 Args:
212212 condition (BaseCondition): The condition to add.
213213 """
214+ warnings .warn (
215+ "Using 'add_condition' is deprecated, use 'condition()' "
216+ "instead. https://leandercs.github.io/flask-inputfilter"
217+ "/options/declarative_api.html" ,
218+ DeprecationWarning ,
219+ stacklevel = 2 ,
220+ )
214221 self .conditions .append (condition )
215222
216223 def _register_decorator_components (self ) -> None :
@@ -497,6 +504,13 @@ def add(
497504 copy (Optional[str]): The name of the field to copy the value
498505 from.
499506 """
507+ warnings .warn (
508+ "Using 'add' is deprecated, use 'field()' "
509+ "instead. https://leandercs.github.io/flask-inputfilter"
510+ "/options/declarative_api.html" ,
511+ DeprecationWarning ,
512+ stacklevel = 2 ,
513+ )
500514 if name in self .fields :
501515 raise ValueError (f"Field '{ name } ' already exists." )
502516
@@ -643,6 +657,13 @@ def add_global_filter(self, filter: BaseFilter) -> None:
643657 Args:
644658 filter: The filter to add.
645659 """
660+ warnings .warn (
661+ "Using 'add_global_filter' is deprecated, use 'global_filter()' "
662+ "instead. https://leandercs.github.io/flask-inputfilter"
663+ "/options/declarative_api.html" ,
664+ DeprecationWarning ,
665+ stacklevel = 2 ,
666+ )
646667 self .global_filters .append (filter )
647668
648669 def get_global_filters (self ) -> list [BaseFilter ]:
@@ -745,6 +766,13 @@ def add_global_validator(self, validator: BaseValidator) -> None:
745766 Args:
746767 validator (BaseValidator): The validator to add.
747768 """
769+ warnings .warn (
770+ "Using 'add_global_validator' is deprecated, use 'global_validator()' "
771+ "instead. https://leandercs.github.io/flask-inputfilter"
772+ "/options/declarative_api.html" ,
773+ DeprecationWarning ,
774+ stacklevel = 2 ,
775+ )
748776 self .global_validators .append (validator )
749777
750778 def get_global_validators (self ) -> list [BaseValidator ]:
0 commit comments