fix create_representation: enrich files with id+path required by AYON
This commit is contained in:
+14
-2
@@ -239,13 +239,25 @@ class AyonClient:
|
||||
name: str,
|
||||
files: list[dict],
|
||||
) -> dict:
|
||||
"""files: [{"name": "BaseColor.png", "size": 12345}, ...]"""
|
||||
"""files: [{"name": "BaseColor.png", "size": 12345}, ...]
|
||||
|
||||
Files are enriched with required 'id' (UUID) and 'path' fields.
|
||||
"""
|
||||
import uuid
|
||||
enriched = []
|
||||
for f in files:
|
||||
enriched.append({
|
||||
"id": uuid.uuid4().hex,
|
||||
"name": f.get("name", f.get("path", "file")),
|
||||
"path": f.get("path", f"/tmp/{f.get('name', 'file')}"),
|
||||
"size": f.get("size", 0),
|
||||
})
|
||||
r = self._client.post(
|
||||
f"/api/projects/{project}/representations",
|
||||
json={
|
||||
"name": name,
|
||||
"versionId": version_id,
|
||||
"files": files,
|
||||
"files": enriched,
|
||||
},
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user