Skip to content

Commit

Permalink
Merge pull request #20 from Vanient/main
Browse files Browse the repository at this point in the history
spec: skip serializing several params if String is empty in Spec
  • Loading branch information
Burning1020 authored Dec 8, 2023
2 parents 6ae9954 + 2c8e6de commit 55eb50e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions crates/sandbox/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ pub struct Linux {
pub devices: Vec<LinuxDevice>,
#[serde(default)]
pub seccomp: Option<LinuxSeccomp>,
#[serde(rename = "rootfsPropagation", default)]
#[serde(
rename = "rootfsPropagation",
skip_serializing_if = "String::is_empty",
default
)]
pub rootfs_propagation: String,
#[serde(rename = "maskedPaths", default)]
pub masked_path: Vec<String>,
#[serde(rename = "readonlyPaths", default)]
pub readonly_path: Vec<String>,
#[serde(rename = "mountLabel", default)]
#[serde(
rename = "mountLabel",
skip_serializing_if = "String::is_empty",
default
)]
pub mount_label: String,
#[serde(rename = "intelRdt")]
pub intel_rdt: Option<LinuxIntelRdt>,
Expand Down Expand Up @@ -242,7 +250,7 @@ pub struct Files {
pub struct LinuxNamespace {
#[serde(default)]
pub r#type: String,
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty", default)]
pub path: String,
}

Expand Down Expand Up @@ -370,7 +378,11 @@ pub struct Process {
pub rlimits: Vec<POSIXRlimit>,
#[serde(rename = "noNewPrivileges", default)]
pub no_new_privileges: bool,
#[serde(rename = "apparmorProfile", default)]
#[serde(
rename = "apparmorProfile",
skip_serializing_if = "String::is_empty",
default
)]
pub apparmor_profile: String,
#[serde(rename = "oomScoreAdj")]
pub oom_score_adj: Option<i32>,
Expand Down

0 comments on commit 55eb50e

Please sign in to comment.