Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aidial_client/types/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Config:
alias_generator = to_camel
allow_population_by_field_name = True

name: str
name: Optional[str] = None
parent_path: Optional[str] = None
bucket: str
url: str
Expand Down
30 changes: 30 additions & 0 deletions tests/test_response_processing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from aidial_client.types.metadata import FileMetadata

BUCKET = "684f6Lz7ubje66aoCRsa5c"

PAYLOAD = {
"bucket": BUCKET,
"name": None,
"nodeType": "FOLDER",
"parentPath": None,
"resourceType": "FILE",
"url": f"files/{BUCKET}/",
"items": [
{
"bucket": BUCKET,
"name": "appdata",
"nodeType": "FOLDER",
"parentPath": None,
"resourceType": "FILE",
"url": f"files/{BUCKET}/appdata/",
}
],
}


def test_name_is_none_round_trip():
"""Root folder returned by the API has name=None; parse→serialize must reproduce the original payload."""
assert PAYLOAD["name"] is None
result = FileMetadata(**PAYLOAD)
assert result.name is None
assert result.model_dump(by_alias=True, exclude_unset=True) == PAYLOAD
Loading