Skip to content

Commit

Permalink
fix(rust): do not export empty/missing values in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Oct 16, 2024
1 parent 9f02acd commit ae7b205
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rust/agama-lib/src/scripts/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ScriptsConfig {
/// User-defined pre-installation scripts
#[serde(skip_serializing_if = "Vec::is_empty")]
pub pre: Vec<ScriptConfig>,
/// User-defined post-installation scripts
#[serde(skip_serializing_if = "Vec::is_empty")]
pub post: Vec<ScriptConfig>,
}

// FIXME: it is just the same than ScriptConfig.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ScriptConfig {
/// Script's name.
pub name: String,
/// Script's body. Either the body or the URL must be specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
/// URL to get the script from. Either the body or the URL must be specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
}

0 comments on commit ae7b205

Please sign in to comment.