From bf19a44fd93584d5250a2e98e5b1d3a2de6d59d1 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 13 Jun 2023 16:15:50 +0200 Subject: [PATCH] admin API: add missing camelCase conversions (fix #381) --- src/api/admin/cluster.rs | 3 +++ src/api/admin/key.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/api/admin/cluster.rs b/src/api/admin/cluster.rs index b2508d2e..a2c97ee5 100644 --- a/src/api/admin/cluster.rs +++ b/src/api/admin/cluster.rs @@ -114,6 +114,7 @@ struct GetClusterStatusResponse { } #[derive(Serialize)] +#[serde(rename_all = "camelCase")] struct ConnectClusterNodesResponse { success: bool, error: Option, @@ -128,6 +129,7 @@ struct GetClusterLayoutResponse { } #[derive(Serialize)] +#[serde(rename_all = "camelCase")] struct KnownNodeResp { addr: SocketAddr, is_up: bool, @@ -197,6 +199,7 @@ pub async fn handle_revert_cluster_layout( type UpdateClusterLayoutRequest = HashMap>; #[derive(Deserialize)] +#[serde(rename_all = "camelCase")] struct ApplyRevertLayoutRequest { version: u64, } diff --git a/src/api/admin/key.rs b/src/api/admin/key.rs index d74ca361..25ba76f8 100644 --- a/src/api/admin/key.rs +++ b/src/api/admin/key.rs @@ -34,6 +34,7 @@ pub async fn handle_list_keys(garage: &Arc) -> Result, Er } #[derive(Serialize)] +#[serde(rename_all = "camelCase")] struct ListKeyResultItem { id: String, name: String, @@ -71,6 +72,7 @@ pub async fn handle_create_key( } #[derive(Deserialize)] +#[serde(rename_all = "camelCase")] struct CreateKeyRequest { name: String, } @@ -131,6 +133,7 @@ pub async fn handle_update_key( } #[derive(Deserialize)] +#[serde(rename_all = "camelCase")] struct UpdateKeyRequest { name: Option, allow: Option, @@ -246,6 +249,7 @@ struct KeyInfoBucketResult { } #[derive(Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] pub(crate) struct ApiBucketKeyPerm { #[serde(default)] pub(crate) read: bool,