Skip to content

Commit 5507360

Browse files
committed
issue updates
1 parent 3fae8f0 commit 5507360

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

fastapi_jsonapi/data_layers/filtering/sqlalchemy.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def cast_value_with_scheme(field_types: List[Type], value: Any) -> Tuple[Any, Li
168168
casted_value = field_type(value)
169169
except (TypeError, ValueError) as ex:
170170
errors.append(str(ex))
171+
else:
172+
return casted_value, errors
171173

172174
return casted_value, errors
173175

@@ -228,7 +230,6 @@ def build_filter_expression(
228230
errors=[HTTPException(status_code=InvalidType.status_code, detail=str(err)) for err in errors],
229231
)
230232

231-
# Если None, при этом поле обязательное (среди типов в аннотации нет None, то кидаем ошибку)
232233
if casted_value is None and not can_be_none:
233234
raise InvalidType(
234235
detail=", ".join(errors),
@@ -256,7 +257,7 @@ def is_relationship_filter(name: str) -> bool:
256257
return RELATIONSHIP_SPLITTER in name
257258

258259

259-
def gather_relationship_paths(filter_item: Union[List, Dict]) -> Set[str]:
260+
def gather_relationship_paths(filter_item: Union[dict, list]) -> Set[str]:
260261
"""
261262
Extracts relationship paths from query filter
262263
"""

tests/test_data_layers/test_filtering/test_sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TestFilteringFuncs:
1515
def test_user_type_cast_success(self):
1616
class UserType:
1717
def __init__(self, *args, **kwargs):
18-
pass
18+
"""This method is needed to handle incoming arguments"""
1919

2020
class ModelSchema(BaseModel):
2121
value: UserType

0 commit comments

Comments
 (0)