Skip to content

Commit f6c02b5

Browse files
committed
Fix callable type check in filter validation
Updated the type check for filter values to correctly identify callables using the `callable()` function. This ensures the validation logic behaves as expected when handling callable objects.
1 parent 82414b0 commit f6c02b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fastcrud/endpoint/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FilterConfig(BaseModel):
5555
@field_validator("filters")
5656
def check_filter_types(cls, filters: dict[str, Any]) -> dict[str, Any]:
5757
for key, value in filters.items():
58-
if not isinstance(value, (type(None), str, int, float, bool, Callable)):
58+
if not (isinstance(value, (type(None), str, int, float, bool)) or callable(value)):
5959
raise ValueError(f"Invalid default value for '{key}': {value}")
6060
return filters
6161

@@ -261,4 +261,4 @@ def filters(
261261
sig = inspect.Signature(params)
262262
setattr(filters, "__signature__", sig)
263263

264-
return filters
264+
return filters

0 commit comments

Comments
 (0)