Handle cases where the field isn't present in network.json for backwards compatibility.

This commit is contained in:
Herbert Wolverson 2023-04-24 13:48:19 +00:00
parent 629ebb0293
commit 36440bdd9c
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ impl NetworkJsonNode {
rtts: self.rtts.iter().map(|n| *n as f32 / 100.0).collect(),
parents: self.parents.clone(),
immediate_parent: self.immediate_parent,
node_type: String::new(),
node_type: None,
}
}
}
@ -72,7 +72,7 @@ pub struct NetworkJsonTransport {
pub immediate_parent: Option<usize>,
/// The type of node (site, ap, etc.)
#[serde(rename = "type")]
pub node_type: String,
pub node_type: Option<String>,
}
/// Holder for the network.json representation.

View File

@ -96,7 +96,7 @@ pub fn get_top_n_root_queues(n_queues: usize) -> BusResponse {
rtts: Vec::new(),
parents: Vec::new(),
immediate_parent: None,
node_type: String::new(),
node_type: None,
},
));
}