Skip to content

Commit 60c2f2c

Browse files
committed
fix: recursively search for true function when validating a wrapped fn
1 parent ae52c60 commit 60c2f2c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

confit/registry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ def validate_arguments(
218218
def validate(_func: Callable) -> Callable:
219219
if isinstance(_func, type):
220220
_func: type
221-
if hasattr(_func.__init__, "__wrapped__"):
222-
vd = ValidatedFunction(_func.__init__.__wrapped__, config)
223-
else:
224-
vd = ValidatedFunction(_func.__init__, config)
221+
vd = _func.__init__
222+
while hasattr(vd, "__wrapped__"):
223+
vd = vd.__wrapped__
224+
vd = ValidatedFunction(vd, config)
225225
vd.model.__name__ = _func.__name__
226226
if PYDANTIC_V1:
227227
vd.model.__fields__["self"].default = None

0 commit comments

Comments
 (0)