Skip to content
/ loom Public

Commit b67d0df

Browse files
ghuntleyclaude
andcommitted
Fix crash projects API response format
- Wrap list_projects response in ProjectListResponse struct - Return { projects: [...] } instead of plain array - Matches expected format in web client CrashProjectListResponse type - Add ProjectListResponse to OpenAPI schema Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 592b002 commit b67d0df

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

crates/loom-server/src/api_docs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ use utoipa::OpenApi;
341341
crate::routes::crash::CrashErrorResponse,
342342
crate::routes::crash::CreateProjectRequest,
343343
crate::routes::crash::ProjectResponse,
344+
crate::routes::crash::ProjectListResponse,
344345
crate::routes::crash::IssueResponse,
345346
crate::routes::crash::ResolveRequest,
346347
crate::routes::crash::IssueDetailResponse,

crates/loom-server/src/routes/crash.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ impl From<CrashProject> for ProjectResponse {
14761476
("org_id" = String, Query, description = "Organization ID"),
14771477
),
14781478
responses(
1479-
(status = 200, description = "List of projects", body = Vec<ProjectResponse>),
1479+
(status = 200, description = "List of projects", body = ProjectListResponse),
14801480
(status = 403, description = "Forbidden", body = CrashErrorResponse),
14811481
),
14821482
security(("bearer" = [])),
@@ -1487,7 +1487,7 @@ pub async fn list_projects(
14871487
State(state): State<AppState>,
14881488
RequireAuth(current_user): RequireAuth,
14891489
Query(params): Query<ListProjectsParams>,
1490-
) -> Result<Json<Vec<ProjectResponse>>, (StatusCode, Json<CrashErrorResponse>)> {
1490+
) -> Result<Json<ProjectListResponse>, (StatusCode, Json<CrashErrorResponse>)> {
14911491
let locale = resolve_user_locale(&current_user, &state.default_locale);
14921492

14931493
let org_id: OrgId = params.org_id.parse().map_err(|_| {
@@ -1513,16 +1513,22 @@ pub async fn list_projects(
15131513
)
15141514
})?;
15151515

1516-
Ok(Json(
1517-
projects.into_iter().map(ProjectResponse::from).collect(),
1518-
))
1516+
Ok(Json(ProjectListResponse {
1517+
projects: projects.into_iter().map(ProjectResponse::from).collect(),
1518+
}))
15191519
}
15201520

15211521
#[derive(Debug, Deserialize)]
15221522
pub struct ListProjectsParams {
15231523
pub org_id: String,
15241524
}
15251525

1526+
/// Response wrapper for list projects endpoint
1527+
#[derive(Debug, Serialize, utoipa::ToSchema)]
1528+
pub struct ProjectListResponse {
1529+
pub projects: Vec<ProjectResponse>,
1530+
}
1531+
15261532
/// POST /api/crash/projects - Create a crash project
15271533
#[utoipa::path(
15281534
post,

0 commit comments

Comments
 (0)