|
2 | 2 | import datetime |
3 | 3 | from collections.abc import AsyncGenerator |
4 | 4 | from pathlib import Path |
5 | | -from typing import TypeAlias |
| 5 | +from typing import Annotated, TypeAlias |
6 | 6 |
|
7 | 7 | import sqlalchemy as sa |
8 | 8 | from models_library.basic_types import SHA256Str |
9 | 9 | from models_library.projects import ProjectID |
10 | 10 | from models_library.projects_nodes_io import NodeID, SimcoreS3FileID |
11 | 11 | from models_library.users import UserID |
12 | 12 | from models_library.utils.fastapi_encoders import jsonable_encoder |
13 | | -from pydantic import BaseModel |
| 13 | +from pydantic import BaseModel, Field, validate_call |
14 | 14 | from simcore_postgres_database.storage_models import file_meta_data |
15 | 15 | from simcore_postgres_database.utils_repos import ( |
16 | 16 | pass_or_acquire_connection, |
@@ -227,18 +227,24 @@ async def try_get_directory( |
227 | 227 | return None |
228 | 228 | return None |
229 | 229 |
|
| 230 | + @validate_call(config={"arbitrary_types_allowed": True}) |
230 | 231 | async def list_child_paths( |
231 | 232 | self, |
232 | 233 | *, |
233 | 234 | connection: AsyncConnection | None = None, |
234 | | - filter_by_project_ids: list[ProjectID] | None, |
| 235 | + filter_by_project_ids: Annotated[ |
| 236 | + list[ProjectID] | None, Field(max_length=10000) |
| 237 | + ], |
235 | 238 | filter_by_file_prefix: Path | None, |
236 | 239 | cursor: GenericCursor | None, |
237 | 240 | limit: int, |
238 | 241 | is_partial_prefix: bool, |
239 | 242 | ) -> tuple[list[PathMetaData], GenericCursor | None, TotalChildren]: |
240 | 243 | """returns a list of FileMetaDataAtDB that are one level deep. |
241 | 244 | e.g. when no filter is used, these are top level objects |
| 245 | +
|
| 246 | + NOTE: if filter_by_project_ids is huge, this will raise ValidationError and someone needs to fix it! |
| 247 | + Maybe using a DB join |
242 | 248 | """ |
243 | 249 |
|
244 | 250 | cursor_params = _init_pagination( |
|
0 commit comments