From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2370895AA5 for ; Thu, 19 Jan 2023 16:52:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0B2E32DDDF for ; Thu, 19 Jan 2023 16:52:37 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 19 Jan 2023 16:52:36 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D13A8452B8 for ; Thu, 19 Jan 2023 16:52:35 +0100 (CET) From: Lukas Wagner To: pbs-devel@lists.proxmox.com Date: Thu, 19 Jan 2023 16:52:32 +0100 Message-Id: <20230119155232.802404-1-l.wagner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.138 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [network.rs, dns.rs, remote.rs] Subject: [pbs-devel] [PATCH proxmox-backup] api: serde-rename deleteable properties to kebab-case X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jan 2023 15:52:37 -0000 In former commit, the enum members were renamed to be CamelCase, in accordance with the usual Rust style guide. However, this broke the GUI in some places due to failing JSON property deserialization. To fix this, some serde(rename = "kebab-case") directives were added. Some properties were also serde-renamed to snake_case, otherwise it would have been necessary to also modify proxmox-widget-toolkit as well as PVE source code. This can follow in a later commit if so desired. Fixes: a2055c38 fix non-camel-case enums Signed-off-by: Lukas Wagner --- src/api2/config/media_pool.rs | 1 + src/api2/config/remote.rs | 1 + src/api2/node/dns.rs | 1 + src/api2/node/network.rs | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api2/config/media_pool.rs b/src/api2/config/media_pool.rs index 79e2e9c5..4a4cec56 100644 --- a/src/api2/config/media_pool.rs +++ b/src/api2/config/media_pool.rs @@ -103,6 +103,7 @@ pub fn get_config(name: String) -> Result { #[api()] #[derive(Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] /// Deletable property name pub enum DeletableProperty { /// Delete media set allocation policy. diff --git a/src/api2/config/remote.rs b/src/api2/config/remote.rs index fb97b3e1..2f02d121 100644 --- a/src/api2/config/remote.rs +++ b/src/api2/config/remote.rs @@ -133,6 +133,7 @@ pub fn read_remote( #[api()] #[derive(Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] /// Deletable property name pub enum DeletableProperty { /// Delete the comment property. diff --git a/src/api2/node/dns.rs b/src/api2/node/dns.rs index 6804a102..4f6822d8 100644 --- a/src/api2/node/dns.rs +++ b/src/api2/node/dns.rs @@ -22,6 +22,7 @@ static RESOLV_CONF_FN: &str = "/etc/resolv.conf"; #[api()] #[derive(Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] /// Deletable property name pub enum DeletableProperty { /// Delete first nameserver entry diff --git a/src/api2/node/network.rs b/src/api2/node/network.rs index fef0a6cb..ade6fe40 100644 --- a/src/api2/node/network.rs +++ b/src/api2/node/network.rs @@ -400,6 +400,7 @@ pub fn create_interface( #[api()] #[derive(Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] /// Deletable property name pub enum DeletableProperty { /// Delete the IPv4 address property. @@ -423,15 +424,17 @@ pub enum DeletableProperty { /// Delete autostart flag Autostart, /// Delete bridge ports (set to 'none') + #[serde(rename = "bridge_ports")] BridgePorts, /// Delete bridge-vlan-aware flag + #[serde(rename = "bridge_vlan_aware")] BridgeVlanAware, /// Delete bond-slaves (set to 'none') Slaves, /// Delete bond-primary - #[serde(rename = "bond-primary")] BondPrimary, /// Delete bond transmit hash policy + #[serde(rename = "bond_xmit_hash_policy")] BondXmitHashPolicy, } -- 2.30.2