Files
basicmachines-co-basic-memory/src/basic_memory/schemas/cloud.py
T
phernandez ba74ca7e18 fix: Update CloudProjectCreateResponse schema to match API response
The /proxy/projects/projects POST endpoint returns a ProjectStatusResponse
with fields: message, status, default, old_project, new_project.

Updated CloudProjectCreateResponse schema to match this format instead of
expecting name, path, message fields.

Also updated all related tests to use the correct response format:
- tests/cli/test_cloud_utils.py (3 tests)
- tests/cli/test_bisync_commands.py (1 test)

Fixes the validation error when creating cloud projects via upload command:
"bm cloud upload --project test --create-project specs"

Signed-off-by: Pablo Hernandez <pablo@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
2025-10-13 23:56:59 -05:00

49 lines
1.8 KiB
Python

"""Schemas for cloud-related API responses."""
from pydantic import BaseModel, Field
class TenantMountInfo(BaseModel):
"""Response from /tenant/mount/info endpoint."""
tenant_id: str = Field(..., description="Unique identifier for the tenant")
bucket_name: str = Field(..., description="S3 bucket name for the tenant")
class MountCredentials(BaseModel):
"""Response from /tenant/mount/credentials endpoint."""
access_key: str = Field(..., description="S3 access key for mount")
secret_key: str = Field(..., description="S3 secret key for mount")
class CloudProject(BaseModel):
"""Representation of a cloud project."""
name: str = Field(..., description="Project name")
path: str = Field(..., description="Project path on cloud")
class CloudProjectList(BaseModel):
"""Response from /proxy/projects/projects endpoint."""
projects: list[CloudProject] = Field(default_factory=list, description="List of cloud projects")
class CloudProjectCreateRequest(BaseModel):
"""Request to create a new cloud project."""
name: str = Field(..., description="Project name")
path: str = Field(..., description="Project path (permalink)")
set_default: bool = Field(default=False, description="Set as default project")
class CloudProjectCreateResponse(BaseModel):
"""Response from creating a cloud project."""
message: str = Field(..., description="Status message about the project creation")
status: str = Field(..., description="Status of the creation (success or error)")
default: bool = Field(..., description="True if the project was set as the default")
old_project: dict | None = Field(None, description="Information about the previous project")
new_project: dict | None = Field(None, description="Information about the newly created project")