From db539e096b9e2e9cbec3412606680cf247035776 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 22:14:36 +0000 Subject: [PATCH] fix: elide unset url and dep in hand DTOs ArenaHandLeftJson and ArenaHandRightJson declared url and dep as plain public auto-properties with no [JsonProperty] and no ShouldSerialize guard, so Newtonsoft's default resolver emitted both on every publish - as explicit JSON nulls when unset. ARENA reads a null attribute value as "delete this attribute", so an update could clear a url or dep the client never set. Both members now follow the idiom used by the rest of the schema set: a private static default plus a matching ShouldSerialize that compares against it. Member names are unchanged, so callers compile as before, and populated values still go on the wire. Refs #184 --- Runtime/Schemas/Object/ArenaHandLeftJson.cs | 19 +++++++++++++++++-- Runtime/Schemas/Object/ArenaHandRightJson.cs | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Runtime/Schemas/Object/ArenaHandLeftJson.cs b/Runtime/Schemas/Object/ArenaHandLeftJson.cs index 4ef2f12c..c3a30166 100644 --- a/Runtime/Schemas/Object/ArenaHandLeftJson.cs +++ b/Runtime/Schemas/Object/ArenaHandLeftJson.cs @@ -18,8 +18,23 @@ public class ArenaHandLeftJson { public string object_type = "handLeft"; - public string url { get; set; } - public string dep { get; set; } + private static string defUrl = null; + [JsonProperty(PropertyName = "url")] + [Tooltip("Path to the hand controller 3D model.")] + public string url = defUrl; + public bool ShouldSerializeurl() + { + return (url != defUrl); + } + + private static string defDep = null; + [JsonProperty(PropertyName = "dep")] + [Tooltip("User id this hand belongs to.")] + public string dep = defDep; + public bool ShouldSerializedep() + { + return (dep != defDep); + } [JsonProperty(PropertyName = "parent")] [Tooltip("Parent's object_id. Child objects inherit attributes of their parent, for example scale and translation.")] diff --git a/Runtime/Schemas/Object/ArenaHandRightJson.cs b/Runtime/Schemas/Object/ArenaHandRightJson.cs index 975ce21d..e2803d4b 100644 --- a/Runtime/Schemas/Object/ArenaHandRightJson.cs +++ b/Runtime/Schemas/Object/ArenaHandRightJson.cs @@ -18,8 +18,23 @@ public class ArenaHandRightJson { public string object_type = "handRight"; - public string url { get; set; } - public string dep { get; set; } + private static string defUrl = null; + [JsonProperty(PropertyName = "url")] + [Tooltip("Path to the hand controller 3D model.")] + public string url = defUrl; + public bool ShouldSerializeurl() + { + return (url != defUrl); + } + + private static string defDep = null; + [JsonProperty(PropertyName = "dep")] + [Tooltip("User id this hand belongs to.")] + public string dep = defDep; + public bool ShouldSerializedep() + { + return (dep != defDep); + } [JsonProperty(PropertyName = "parent")] [Tooltip("Parent's object_id. Child objects inherit attributes of their parent, for example scale and translation.")]