Skip to content

Commit

Permalink
avoid serializing empty fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Sopena Ballesteros committed Aug 15, 2023
1 parent 4b394f1 commit 3ddcb4c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/shasta/cfs/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,36 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct State {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "cloneUrl")]
clone_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
playbook: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
commit: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "sesisonName")]
session_name: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Component {
id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
state: Option<Vec<State>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "stateAppend")]
state_append: Option<State>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "desiredConfig")]
desired_config: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "errorCount")]
error_count: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "retryPolicy")]
retry_policy: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
enabled: Option<bool>,
// tags: TODO: this is supposed to be an object??? https://csm12-apidocs.svc.cscs.ch/paas/cfs/operation/patch_component/#!path=tags&t=request
}
Expand Down

0 comments on commit 3ddcb4c

Please sign in to comment.