[pdm-devel] [PATCH proxmox 4/4] proxmox-apt-api-types: make APTStandardRepository compatible with PVE's serialization of the type

Lukas Wagner l.wagner at proxmox.com
Thu Nov 27 11:44:33 CET 2025


The bools were serialized as '0' and '1', so we need the
proxmox_serde::perl::deserialize_bool helpers  to deserialize them.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 proxmox-apt-api-types/Cargo.toml | 1 +
 proxmox-apt-api-types/src/lib.rs | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/proxmox-apt-api-types/Cargo.toml b/proxmox-apt-api-types/Cargo.toml
index 72ceac91..37e422fb 100644
--- a/proxmox-apt-api-types/Cargo.toml
+++ b/proxmox-apt-api-types/Cargo.toml
@@ -14,4 +14,5 @@ exclude.workspace = true
 serde = { workspace = true, features = ["derive"] }
 serde_plain.workspace = true
 proxmox-schema = { workspace = true, features = ["api-macro"] }
+proxmox-serde.workspace = true
 proxmox-config-digest.workspace = true
diff --git a/proxmox-apt-api-types/src/lib.rs b/proxmox-apt-api-types/src/lib.rs
index 58bd1973..7f3a01c8 100644
--- a/proxmox-apt-api-types/src/lib.rs
+++ b/proxmox-apt-api-types/src/lib.rs
@@ -147,6 +147,7 @@ pub struct APTRepository {
     pub file_type: APTRepositoryFileType,
 
     /// Whether the repository is enabled or not.
+    #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")]
     pub enabled: bool,
 }
 
@@ -256,7 +257,11 @@ pub struct APTStandardRepository {
 
     /// Configuration status of the associated repository, where `None` means
     /// not configured, and `Some(bool)` indicates enabled or disabled.
-    #[serde(skip_serializing_if = "Option::is_none")]
+    #[serde(
+        default,
+        skip_serializing_if = "Option::is_none",
+        deserialize_with = "proxmox_serde::perl::deserialize_bool"
+    )]
     pub status: Option<bool>,
 
     /// Display name of the repository.
-- 
2.47.3





More information about the pdm-devel mailing list