diff --git a/particle-builtins/src/identify.rs b/particle-builtins/src/identify.rs index f1d6f50cbb..8b17f2b240 100644 --- a/particle-builtins/src/identify.rs +++ b/particle-builtins/src/identify.rs @@ -26,9 +26,21 @@ pub struct NodeInfo { pub air_version: &'static str, pub spell_version: String, pub allowed_effectors: Vec, + // Note: this is Vec for Aqua's representation of an option + #[serde(serialize_with = "serialize_aqua_option")] pub vm_info: Option, } +fn serialize_aqua_option(value: &Option, serializer: S) -> Result +where + S: serde::Serializer, +{ + match value { + Some(vm_info) => serializer.collect_seq(&[vm_info]), + None => serializer.serialize_none(), + } +} + #[derive(Serialize, Clone, Debug)] pub struct VmInfo { // Public IP via which we can connect to the VM