From 4deb57815ac11bfadc4eecb4c8f5c1a62c09b184 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Sat, 23 Aug 2025 13:02:03 -0400 Subject: [PATCH 1/2] fix(api): use query params, not path params for Update & Delete Bucket --- src/api/admin/api.rs | 7 +++++-- src/api/admin/openapi.rs | 8 ++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/api/admin/api.rs b/src/api/admin/api.rs index fc2d9b76..3676eb7a 100644 --- a/src/api/admin/api.rs +++ b/src/api/admin/api.rs @@ -891,9 +891,11 @@ pub struct CreateBucketLocalAlias { // ---- UpdateBucket ---- -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, IntoParams)] +#[into_params(parameter_in = Query)] pub struct UpdateBucketRequest { pub id: String, + #[param(ignore = true)] pub body: UpdateBucketRequestBody, } @@ -917,7 +919,8 @@ pub struct UpdateBucketWebsiteAccess { // ---- DeleteBucket ---- -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, IntoParams)] +#[into_params(parameter_in = Query)] pub struct DeleteBucketRequest { pub id: String, } diff --git a/src/api/admin/openapi.rs b/src/api/admin/openapi.rs index 248fd29f..d216f950 100644 --- a/src/api/admin/openapi.rs +++ b/src/api/admin/openapi.rs @@ -478,9 +478,7 @@ In `quotas`: new values of `maxSize` and `maxObjects` must both be specified, or to remove the quotas. An absent value will be considered the same as a `null`. It is not possible to change only one of the two quotas. ", - params( - ("id" = String, description = "ID of the bucket to update"), - ), + params(UpdateBucketRequest), request_body = UpdateBucketRequestBody, responses( (status = 200, description = "Bucket has been updated", body = UpdateBucketResponse), @@ -498,9 +496,7 @@ Deletes a storage bucket. A bucket cannot be deleted if it is not empty. **Warning:** this will delete all aliases associated with the bucket! ", - params( - ("id" = String, description = "ID of the bucket to delete"), - ), + params(DeleteBucketRequest), responses( (status = 200, description = "Bucket has been deleted"), (status = 400, description = "Bucket is not empty"), From 16128fca631f602f0bbf721cfdc8a1cfb86e2b97 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Wed, 3 Sep 2025 21:08:47 -0400 Subject: [PATCH 2/2] chore: re-generate OpenAPI spec ``` cargo run -- admin-api-schema > doc/api/garage-admin-v2.json ``` --- doc/api/garage-admin-v2.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/api/garage-admin-v2.json b/doc/api/garage-admin-v2.json index 885b7355..61c4440d 100644 --- a/doc/api/garage-admin-v2.json +++ b/doc/api/garage-admin-v2.json @@ -471,8 +471,7 @@ "parameters": [ { "name": "id", - "in": "path", - "description": "ID of the bucket to delete", + "in": "query", "required": true, "schema": { "type": "string" @@ -1601,8 +1600,7 @@ "parameters": [ { "name": "id", - "in": "path", - "description": "ID of the bucket to update", + "in": "query", "required": true, "schema": { "type": "string"