proxmox-apt: fix serde attributes for API types

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2023-12-02 14:45:57 +01:00
parent 50b79198f8
commit 1859be3588
2 changed files with 9 additions and 7 deletions

View File

@ -61,9 +61,11 @@ pub struct APTRepositoryFile {
pub repositories: Vec<APTRepository>,
/// The file content, if already parsed.
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<String>,
/// Digest of the original contents.
#[serde(skip_serializing_if = "Option::is_none")]
pub digest: Option<[u8; 32]>,
}
@ -97,7 +99,7 @@ impl std::error::Error for APTRepositoryFileError {
/// Additional information for a repository.
pub struct APTRepositoryInfo {
/// Path to the defining file.
#[serde(skip_serializing_if = "String::is_empty")]
#[serde(default, skip_serializing_if = "String::is_empty")]
pub path: String,
/// Index of the associated respository within the file (starting from 0).

View File

@ -157,28 +157,28 @@ pub struct APTRepositoryOption {
/// Describes an APT repository.
pub struct APTRepository {
/// List of package types.
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub types: Vec<APTRepositoryPackageType>,
/// List of repository URIs.
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
#[serde(rename = "URIs")]
pub uris: Vec<String>,
/// List of package distributions.
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub suites: Vec<String>,
/// List of repository components.
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub components: Vec<String>,
/// Additional options.
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub options: Vec<APTRepositoryOption>,
/// Associated comment.
#[serde(skip_serializing_if = "String::is_empty")]
#[serde(default, skip_serializing_if = "String::is_empty")]
pub comment: String,
/// Format of the defining file.