Skip to content

Fix PHP jsonSerialize() methods to return correct outputs for empty objects #796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

K-Phoen
Copy link
Member

@K-Phoen K-Phoen commented Apr 17, 2025

Storing data in an array in jsonSerialize() methods is convenient, but it has the nasty side-effect of not allowing the json_encode() function to distinguish between empty arrays and empty objects. Both get encoded as [].

For example, we get the following error when validating a dashboard that doesn't have annotations:

`Dashboard.dashboard.grafana.app \"test-dashboard\" is invalid: spec.annotations: Invalid value: conflicting values [] and {list?:[...#AnnotationQuery]} (mismatched types list and struct)`

That's because within the generated dashboard JSON, the annotations field is defined as "annotations": [] instead of "annotations": {}.

This PR fixes that issue by storing the data in a stdClass object, so that even if they're empty json_encode() will know to encode them as objects.

@K-Phoen K-Phoen self-assigned this Apr 17, 2025
@K-Phoen K-Phoen requested a review from a team as a code owner April 17, 2025 11:07
Copy link

Note: the diff show code changes that would be introduced by this PR to the output of the config/foundation_sdk.dev.yaml codegen pipeline (dev version of the Foundation SDK).

🔎 Changes to config/foundation_sdk.dev.yaml

diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/ContactPoint.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/ContactPoint.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/ContactPoint.php	2025-04-17 11:10:38.173189222 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/ContactPoint.php	2025-04-17 11:10:01.721012023 +0000
@@ -76,25 +76,24 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "settings" => $this->settings,
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->settings = $this->settings;
+        $data->type = $this->type;
         if (isset($this->disableResolveMessage)) {
-            $data["disableResolveMessage"] = $this->disableResolveMessage;
+            $data->disableResolveMessage = $this->disableResolveMessage;
         }
         if (isset($this->name)) {
-            $data["name"] = $this->name;
+            $data->name = $this->name;
         }
         if (isset($this->provenance)) {
-            $data["provenance"] = $this->provenance;
+            $data->provenance = $this->provenance;
         }
         if (isset($this->uid)) {
-            $data["uid"] = $this->uid;
+            $data->uid = $this->uid;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/DayOfMonthRange.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/DayOfMonthRange.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/DayOfMonthRange.php	2025-04-17 11:10:38.173189222 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/DayOfMonthRange.php	2025-04-17 11:10:01.721012023 +0000
@@ -41,17 +41,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->begin)) {
-            $data["begin"] = $this->begin;
+            $data->begin = $this->begin;
         }
         if (isset($this->end)) {
-            $data["end"] = $this->end;
+            $data->end = $this->end;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/Matcher.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/Matcher.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/Matcher.php	2025-04-17 11:10:38.173189222 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/Matcher.php	2025-04-17 11:10:01.721012023 +0000
@@ -46,20 +46,19 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->name)) {
-            $data["Name"] = $this->name;
+            $data->Name = $this->name;
         }
         if (isset($this->type)) {
-            $data["Type"] = $this->type;
+            $data->Type = $this->type;
         }
         if (isset($this->value)) {
-            $data["Value"] = $this->value;
+            $data->Value = $this->value;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/MonthRange.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/MonthRange.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/MonthRange.php	2025-04-17 11:10:38.173189222 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/MonthRange.php	2025-04-17 11:10:01.721012023 +0000
@@ -41,17 +41,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->begin)) {
-            $data["begin"] = $this->begin;
+            $data->begin = $this->begin;
         }
         if (isset($this->end)) {
-            $data["end"] = $this->end;
+            $data->end = $this->end;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/MuteTiming.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/MuteTiming.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/MuteTiming.php	2025-04-17 11:10:38.173189222 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/MuteTiming.php	2025-04-17 11:10:01.721012023 +0000
@@ -46,17 +46,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->name)) {
-            $data["name"] = $this->name;
+            $data->name = $this->name;
         }
         if (isset($this->timeIntervals)) {
-            $data["time_intervals"] = $this->timeIntervals;
+            $data->time_intervals = $this->timeIntervals;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/NotificationPolicy.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/NotificationPolicy.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/NotificationPolicy.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/NotificationPolicy.php	2025-04-17 11:10:01.721012023 +0000
@@ -159,45 +159,44 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "match_re" => $this->matchRe,
-            "matchers" => $this->matchers,
-            "object_matchers" => $this->objectMatchers,
-            "provenance" => $this->provenance,
-        ];
+        $data = new \stdClass;
+        $data->match_re = $this->matchRe;
+        $data->matchers = $this->matchers;
+        $data->object_matchers = $this->objectMatchers;
+        $data->provenance = $this->provenance;
         if (isset($this->activeTimeIntervals)) {
-            $data["active_time_intervals"] = $this->activeTimeIntervals;
+            $data->active_time_intervals = $this->activeTimeIntervals;
         }
         if (isset($this->continue)) {
-            $data["continue"] = $this->continue;
+            $data->continue = $this->continue;
         }
         if (isset($this->groupBy)) {
-            $data["group_by"] = $this->groupBy;
+            $data->group_by = $this->groupBy;
         }
         if (isset($this->groupInterval)) {
-            $data["group_interval"] = $this->groupInterval;
+            $data->group_interval = $this->groupInterval;
         }
         if (isset($this->groupWait)) {
-            $data["group_wait"] = $this->groupWait;
+            $data->group_wait = $this->groupWait;
         }
         if (isset($this->match)) {
-            $data["match"] = $this->match;
+            $data->match = $this->match;
         }
         if (isset($this->muteTimeIntervals)) {
-            $data["mute_time_intervals"] = $this->muteTimeIntervals;
+            $data->mute_time_intervals = $this->muteTimeIntervals;
         }
         if (isset($this->receiver)) {
-            $data["receiver"] = $this->receiver;
+            $data->receiver = $this->receiver;
         }
         if (isset($this->repeatInterval)) {
-            $data["repeat_interval"] = $this->repeatInterval;
+            $data->repeat_interval = $this->repeatInterval;
         }
         if (isset($this->routes)) {
-            $data["routes"] = $this->routes;
+            $data->routes = $this->routes;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/NotificationSettings.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/NotificationSettings.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/NotificationSettings.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/NotificationSettings.php	2025-04-17 11:10:01.721012023 +0000
@@ -93,27 +93,26 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "receiver" => $this->receiver,
-        ];
+        $data = new \stdClass;
+        $data->receiver = $this->receiver;
         if (isset($this->groupBy)) {
-            $data["group_by"] = $this->groupBy;
+            $data->group_by = $this->groupBy;
         }
         if (isset($this->groupInterval)) {
-            $data["group_interval"] = $this->groupInterval;
+            $data->group_interval = $this->groupInterval;
         }
         if (isset($this->groupWait)) {
-            $data["group_wait"] = $this->groupWait;
+            $data->group_wait = $this->groupWait;
         }
         if (isset($this->muteTimeIntervals)) {
-            $data["mute_time_intervals"] = $this->muteTimeIntervals;
+            $data->mute_time_intervals = $this->muteTimeIntervals;
         }
         if (isset($this->repeatInterval)) {
-            $data["repeat_interval"] = $this->repeatInterval;
+            $data->repeat_interval = $this->repeatInterval;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/NotificationTemplate.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/NotificationTemplate.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/NotificationTemplate.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/NotificationTemplate.php	2025-04-17 11:10:01.721012023 +0000
@@ -54,21 +54,20 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "provenance" => $this->provenance,
-        ];
+        $data = new \stdClass;
+        $data->provenance = $this->provenance;
         if (isset($this->name)) {
-            $data["name"] = $this->name;
+            $data->name = $this->name;
         }
         if (isset($this->template)) {
-            $data["template"] = $this->template;
+            $data->template = $this->template;
         }
         if (isset($this->version)) {
-            $data["version"] = $this->version;
+            $data->version = $this->version;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/Query.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/Query.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/Query.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/Query.php	2025-04-17 11:10:01.722012029 +0000
@@ -84,26 +84,25 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->datasourceUid)) {
-            $data["datasourceUid"] = $this->datasourceUid;
+            $data->datasourceUid = $this->datasourceUid;
         }
         if (isset($this->model)) {
-            $data["model"] = $this->model;
+            $data->model = $this->model;
         }
         if (isset($this->queryType)) {
-            $data["queryType"] = $this->queryType;
+            $data->queryType = $this->queryType;
         }
         if (isset($this->refId)) {
-            $data["refId"] = $this->refId;
+            $data->refId = $this->refId;
         }
         if (isset($this->relativeTimeRange)) {
-            $data["relativeTimeRange"] = $this->relativeTimeRange;
+            $data->relativeTimeRange = $this->relativeTimeRange;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/RecordRule.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/RecordRule.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/RecordRule.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/RecordRule.php	2025-04-17 11:10:01.722012029 +0000
@@ -50,16 +50,15 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "from" => $this->from,
-            "metric" => $this->metric,
-        ];
+        $data = new \stdClass;
+        $data->from = $this->from;
+        $data->metric = $this->metric;
         if (isset($this->targetDatasourceUid)) {
-            $data["target_datasource_uid"] = $this->targetDatasourceUid;
+            $data->target_datasource_uid = $this->targetDatasourceUid;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/RelativeTimeRange.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/RelativeTimeRange.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/RelativeTimeRange.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/RelativeTimeRange.php	2025-04-17 11:10:01.722012029 +0000
@@ -48,14 +48,13 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "from" => $this->from,
-            "to" => $this->to,
-        ];
+        $data = new \stdClass;
+        $data->from = $this->from;
+        $data->to = $this->to;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/Rule.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/Rule.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/Rule.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/Rule.php	2025-04-17 11:10:01.722012029 +0000
@@ -180,51 +180,50 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "condition" => $this->condition,
-            "data" => $this->data,
-            "execErrState" => $this->execErrState,
-            "folderUID" => $this->folderUID,
-            "for" => $this->for,
-            "noDataState" => $this->noDataState,
-            "orgID" => $this->orgID,
-            "provenance" => $this->provenance,
-            "ruleGroup" => $this->ruleGroup,
-            "title" => $this->title,
-        ];
+        $data = new \stdClass;
+        $data->condition = $this->condition;
+        $data->data = $this->data;
+        $data->execErrState = $this->execErrState;
+        $data->folderUID = $this->folderUID;
+        $data->for = $this->for;
+        $data->noDataState = $this->noDataState;
+        $data->orgID = $this->orgID;
+        $data->provenance = $this->provenance;
+        $data->ruleGroup = $this->ruleGroup;
+        $data->title = $this->title;
         if (isset($this->annotations)) {
-            $data["annotations"] = $this->annotations;
+            $data->annotations = $this->annotations;
         }
         if (isset($this->id)) {
-            $data["id"] = $this->id;
+            $data->id = $this->id;
         }
         if (isset($this->isPaused)) {
-            $data["isPaused"] = $this->isPaused;
+            $data->isPaused = $this->isPaused;
         }
         if (isset($this->keepFiringFor)) {
-            $data["keep_firing_for"] = $this->keepFiringFor;
+            $data->keep_firing_for = $this->keepFiringFor;
         }
         if (isset($this->labels)) {
-            $data["labels"] = $this->labels;
+            $data->labels = $this->labels;
         }
         if (isset($this->missingSeriesEvalsToResolve)) {
-            $data["missingSeriesEvalsToResolve"] = $this->missingSeriesEvalsToResolve;
+            $data->missingSeriesEvalsToResolve = $this->missingSeriesEvalsToResolve;
         }
         if (isset($this->notificationSettings)) {
-            $data["notification_settings"] = $this->notificationSettings;
+            $data->notification_settings = $this->notificationSettings;
         }
         if (isset($this->record)) {
-            $data["record"] = $this->record;
+            $data->record = $this->record;
         }
         if (isset($this->uid)) {
-            $data["uid"] = $this->uid;
+            $data->uid = $this->uid;
         }
         if (isset($this->updated)) {
-            $data["updated"] = $this->updated;
+            $data->updated = $this->updated;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/RuleGroup.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/RuleGroup.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/RuleGroup.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/RuleGroup.php	2025-04-17 11:10:01.722012029 +0000
@@ -65,21 +65,20 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "interval" => $this->interval,
-        ];
+        $data = new \stdClass;
+        $data->interval = $this->interval;
         if (isset($this->folderUid)) {
-            $data["folderUid"] = $this->folderUid;
+            $data->folderUid = $this->folderUid;
         }
         if (isset($this->rules)) {
-            $data["rules"] = $this->rules;
+            $data->rules = $this->rules;
         }
         if (isset($this->title)) {
-            $data["title"] = $this->title;
+            $data->title = $this->title;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/TimeInterval.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/TimeInterval.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/TimeInterval.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/TimeInterval.php	2025-04-17 11:10:01.722012029 +0000
@@ -98,27 +98,26 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "location" => $this->location,
-        ];
+        $data = new \stdClass;
+        $data->location = $this->location;
         if (isset($this->times)) {
-            $data["times"] = $this->times;
+            $data->times = $this->times;
         }
         if (isset($this->weekdays)) {
-            $data["weekdays"] = $this->weekdays;
+            $data->weekdays = $this->weekdays;
         }
         if (isset($this->daysOfMonth)) {
-            $data["days_of_month"] = $this->daysOfMonth;
+            $data->days_of_month = $this->daysOfMonth;
         }
         if (isset($this->months)) {
-            $data["months"] = $this->months;
+            $data->months = $this->months;
         }
         if (isset($this->years)) {
-            $data["years"] = $this->years;
+            $data->years = $this->years;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/TimeRange.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/TimeRange.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/TimeRange.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/TimeRange.php	2025-04-17 11:10:01.722012029 +0000
@@ -41,17 +41,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->from)) {
-            $data["from"] = $this->from;
+            $data->from = $this->from;
         }
         if (isset($this->to)) {
-            $data["to"] = $this->to;
+            $data->to = $this->to;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/WeekdayRange.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/WeekdayRange.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/WeekdayRange.php	2025-04-17 11:10:38.174189228 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/WeekdayRange.php	2025-04-17 11:10:01.722012029 +0000
@@ -41,17 +41,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->begin)) {
-            $data["begin"] = $this->begin;
+            $data->begin = $this->begin;
         }
         if (isset($this->end)) {
-            $data["end"] = $this->end;
+            $data->end = $this->end;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/YearRange.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/YearRange.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Alerting/YearRange.php	2025-04-17 11:10:38.175189234 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Alerting/YearRange.php	2025-04-17 11:10:01.722012029 +0000
@@ -41,17 +41,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->begin)) {
-            $data["begin"] = $this->begin;
+            $data->begin = $this->begin;
         }
         if (isset($this->end)) {
-            $data["end"] = $this->end;
+            $data->end = $this->end;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Annotationslist/Options.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Annotationslist/Options.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Annotationslist/Options.php	2025-04-17 11:10:38.175189234 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Annotationslist/Options.php	2025-04-17 11:10:01.722012029 +0000
@@ -75,22 +75,21 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "onlyFromThisDashboard" => $this->onlyFromThisDashboard,
-            "onlyInTimeRange" => $this->onlyInTimeRange,
-            "tags" => $this->tags,
-            "limit" => $this->limit,
-            "showUser" => $this->showUser,
-            "showTime" => $this->showTime,
-            "showTags" => $this->showTags,
-            "navigateToPanel" => $this->navigateToPanel,
-            "navigateBefore" => $this->navigateBefore,
-            "navigateAfter" => $this->navigateAfter,
-        ];
+        $data = new \stdClass;
+        $data->onlyFromThisDashboard = $this->onlyFromThisDashboard;
+        $data->onlyInTimeRange = $this->onlyInTimeRange;
+        $data->tags = $this->tags;
+        $data->limit = $this->limit;
+        $data->showUser = $this->showUser;
+        $data->showTime = $this->showTime;
+        $data->showTags = $this->showTags;
+        $data->navigateToPanel = $this->navigateToPanel;
+        $data->navigateBefore = $this->navigateBefore;
+        $data->navigateAfter = $this->navigateAfter;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Athena/ConnectionArgs.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Athena/ConnectionArgs.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Athena/ConnectionArgs.php	2025-04-17 11:10:38.175189234 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Athena/ConnectionArgs.php	2025-04-17 11:10:01.723012035 +0000
@@ -62,26 +62,25 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->region)) {
-            $data["region"] = $this->region;
+            $data->region = $this->region;
         }
         if (isset($this->catalog)) {
-            $data["catalog"] = $this->catalog;
+            $data->catalog = $this->catalog;
         }
         if (isset($this->database)) {
-            $data["database"] = $this->database;
+            $data->database = $this->database;
         }
         if (isset($this->resultReuseEnabled)) {
-            $data["resultReuseEnabled"] = $this->resultReuseEnabled;
+            $data->resultReuseEnabled = $this->resultReuseEnabled;
         }
         if (isset($this->resultReuseMaxAgeInMinutes)) {
-            $data["resultReuseMaxAgeInMinutes"] = $this->resultReuseMaxAgeInMinutes;
+            $data->resultReuseMaxAgeInMinutes = $this->resultReuseMaxAgeInMinutes;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Athena/Dataquery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Athena/Dataquery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Athena/Dataquery.php	2025-04-17 11:10:38.175189234 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Athena/Dataquery.php	2025-04-17 11:10:01.723012035 +0000
@@ -115,33 +115,32 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "format" => $this->format,
-            "connectionArgs" => $this->connectionArgs,
-            "refId" => $this->refId,
-            "rawSQL" => $this->rawSQL,
-        ];
+        $data = new \stdClass;
+        $data->format = $this->format;
+        $data->connectionArgs = $this->connectionArgs;
+        $data->refId = $this->refId;
+        $data->rawSQL = $this->rawSQL;
         if (isset($this->table)) {
-            $data["table"] = $this->table;
+            $data->table = $this->table;
         }
         if (isset($this->column)) {
-            $data["column"] = $this->column;
+            $data->column = $this->column;
         }
         if (isset($this->queryID)) {
-            $data["queryID"] = $this->queryID;
+            $data->queryID = $this->queryID;
         }
         if (isset($this->hide)) {
-            $data["hide"] = $this->hide;
+            $data->hide = $this->hide;
         }
         if (isset($this->queryType)) {
-            $data["queryType"] = $this->queryType;
+            $data->queryType = $this->queryType;
         }
         if (isset($this->datasource)) {
-            $data["datasource"] = $this->datasource;
+            $data->datasource = $this->datasource;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AppInsightsGroupByQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AppInsightsGroupByQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AppInsightsGroupByQuery.php	2025-04-17 11:10:38.175189234 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AppInsightsGroupByQuery.php	2025-04-17 11:10:01.723012035 +0000
@@ -39,16 +39,15 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "kind" => $this->kind,
-            "metricName" => $this->metricName,
-        ];
+        $data = new \stdClass;
+        $data->kind = $this->kind;
+        $data->metricName = $this->metricName;
         if (isset($this->rawQuery)) {
-            $data["rawQuery"] = $this->rawQuery;
+            $data->rawQuery = $this->rawQuery;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AppInsightsMetricNameQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AppInsightsMetricNameQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AppInsightsMetricNameQuery.php	2025-04-17 11:10:38.175189234 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AppInsightsMetricNameQuery.php	2025-04-17 11:10:01.723012035 +0000
@@ -34,15 +34,14 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "kind" => $this->kind,
-        ];
+        $data = new \stdClass;
+        $data->kind = $this->kind;
         if (isset($this->rawQuery)) {
-            $data["rawQuery"] = $this->rawQuery;
+            $data->rawQuery = $this->rawQuery;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureLogsQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureLogsQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureLogsQuery.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureLogsQuery.php	2025-04-17 11:10:01.723012035 +0000
@@ -129,44 +129,43 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->query)) {
-            $data["query"] = $this->query;
+            $data->query = $this->query;
         }
         if (isset($this->resultFormat)) {
-            $data["resultFormat"] = $this->resultFormat;
+            $data->resultFormat = $this->resultFormat;
         }
         if (isset($this->resources)) {
-            $data["resources"] = $this->resources;
+            $data->resources = $this->resources;
         }
         if (isset($this->dashboardTime)) {
-            $data["dashboardTime"] = $this->dashboardTime;
+            $data->dashboardTime = $this->dashboardTime;
         }
         if (isset($this->timeColumn)) {
-            $data["timeColumn"] = $this->timeColumn;
+            $data->timeColumn = $this->timeColumn;
         }
         if (isset($this->basicLogsQuery)) {
-            $data["basicLogsQuery"] = $this->basicLogsQuery;
+            $data->basicLogsQuery = $this->basicLogsQuery;
         }
         if (isset($this->workspace)) {
-            $data["workspace"] = $this->workspace;
+            $data->workspace = $this->workspace;
         }
         if (isset($this->mode)) {
-            $data["mode"] = $this->mode;
+            $data->mode = $this->mode;
         }
         if (isset($this->builderQuery)) {
-            $data["builderQuery"] = $this->builderQuery;
+            $data->builderQuery = $this->builderQuery;
         }
         if (isset($this->resource)) {
-            $data["resource"] = $this->resource;
+            $data->resource = $this->resource;
         }
         if (isset($this->intersectTime)) {
-            $data["intersectTime"] = $this->intersectTime;
+            $data->intersectTime = $this->intersectTime;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMetricDimension.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMetricDimension.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMetricDimension.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMetricDimension.php	2025-04-17 11:10:01.723012035 +0000
@@ -59,23 +59,22 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->dimension)) {
-            $data["dimension"] = $this->dimension;
+            $data->dimension = $this->dimension;
         }
         if (isset($this->operator)) {
-            $data["operator"] = $this->operator;
+            $data->operator = $this->operator;
         }
         if (isset($this->filters)) {
-            $data["filters"] = $this->filters;
+            $data->filters = $this->filters;
         }
         if (isset($this->filter)) {
-            $data["filter"] = $this->filter;
+            $data->filter = $this->filter;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMetricQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMetricQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMetricQuery.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMetricQuery.php	2025-04-17 11:10:01.723012035 +0000
@@ -197,65 +197,64 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->resources)) {
-            $data["resources"] = $this->resources;
+            $data->resources = $this->resources;
         }
         if (isset($this->metricNamespace)) {
-            $data["metricNamespace"] = $this->metricNamespace;
+            $data->metricNamespace = $this->metricNamespace;
         }
         if (isset($this->customNamespace)) {
-            $data["customNamespace"] = $this->customNamespace;
+            $data->customNamespace = $this->customNamespace;
         }
         if (isset($this->metricName)) {
-            $data["metricName"] = $this->metricName;
+            $data->metricName = $this->metricName;
         }
         if (isset($this->region)) {
-            $data["region"] = $this->region;
+            $data->region = $this->region;
         }
         if (isset($this->timeGrain)) {
-            $data["timeGrain"] = $this->timeGrain;
+            $data->timeGrain = $this->timeGrain;
         }
         if (isset($this->aggregation)) {
-            $data["aggregation"] = $this->aggregation;
+            $data->aggregation = $this->aggregation;
         }
         if (isset($this->dimensionFilters)) {
-            $data["dimensionFilters"] = $this->dimensionFilters;
+            $data->dimensionFilters = $this->dimensionFilters;
         }
         if (isset($this->top)) {
-            $data["top"] = $this->top;
+            $data->top = $this->top;
         }
         if (isset($this->allowedTimeGrainsMs)) {
-            $data["allowedTimeGrainsMs"] = $this->allowedTimeGrainsMs;
+            $data->allowedTimeGrainsMs = $this->allowedTimeGrainsMs;
         }
         if (isset($this->alias)) {
-            $data["alias"] = $this->alias;
+            $data->alias = $this->alias;
         }
         if (isset($this->timeGrainUnit)) {
-            $data["timeGrainUnit"] = $this->timeGrainUnit;
+            $data->timeGrainUnit = $this->timeGrainUnit;
         }
         if (isset($this->dimension)) {
-            $data["dimension"] = $this->dimension;
+            $data->dimension = $this->dimension;
         }
         if (isset($this->dimensionFilter)) {
-            $data["dimensionFilter"] = $this->dimensionFilter;
+            $data->dimensionFilter = $this->dimensionFilter;
         }
         if (isset($this->metricDefinition)) {
-            $data["metricDefinition"] = $this->metricDefinition;
+            $data->metricDefinition = $this->metricDefinition;
         }
         if (isset($this->resourceUri)) {
-            $data["resourceUri"] = $this->resourceUri;
+            $data->resourceUri = $this->resourceUri;
         }
         if (isset($this->resourceGroup)) {
-            $data["resourceGroup"] = $this->resourceGroup;
+            $data->resourceGroup = $this->resourceGroup;
         }
         if (isset($this->resourceName)) {
-            $data["resourceName"] = $this->resourceName;
+            $data->resourceName = $this->resourceName;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMonitorQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMonitorQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMonitorQuery.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMonitorQuery.php	2025-04-17 11:10:01.724012041 +0000
@@ -234,58 +234,57 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "refId" => $this->refId,
-            "grafanaTemplateVariableFn" => $this->grafanaTemplateVariableFn,
-        ];
+        $data = new \stdClass;
+        $data->refId = $this->refId;
+        $data->grafanaTemplateVariableFn = $this->grafanaTemplateVariableFn;
         if (isset($this->hide)) {
-            $data["hide"] = $this->hide;
+            $data->hide = $this->hide;
         }
         if (isset($this->queryType)) {
-            $data["queryType"] = $this->queryType;
+            $data->queryType = $this->queryType;
         }
         if (isset($this->subscription)) {
-            $data["subscription"] = $this->subscription;
+            $data->subscription = $this->subscription;
         }
         if (isset($this->subscriptions)) {
-            $data["subscriptions"] = $this->subscriptions;
+            $data->subscriptions = $this->subscriptions;
         }
         if (isset($this->azureMonitor)) {
-            $data["azureMonitor"] = $this->azureMonitor;
+            $data->azureMonitor = $this->azureMonitor;
         }
         if (isset($this->azureLogAnalytics)) {
-            $data["azureLogAnalytics"] = $this->azureLogAnalytics;
+            $data->azureLogAnalytics = $this->azureLogAnalytics;
         }
         if (isset($this->azureResourceGraph)) {
-            $data["azureResourceGraph"] = $this->azureResourceGraph;
+            $data->azureResourceGraph = $this->azureResourceGraph;
         }
         if (isset($this->azureTraces)) {
-            $data["azureTraces"] = $this->azureTraces;
+            $data->azureTraces = $this->azureTraces;
         }
         if (isset($this->resourceGroup)) {
-            $data["resourceGroup"] = $this->resourceGroup;
+            $data->resourceGroup = $this->resourceGroup;
         }
         if (isset($this->namespace)) {
-            $data["namespace"] = $this->namespace;
+            $data->namespace = $this->namespace;
         }
         if (isset($this->resource)) {
-            $data["resource"] = $this->resource;
+            $data->resource = $this->resource;
         }
         if (isset($this->region)) {
-            $data["region"] = $this->region;
+            $data->region = $this->region;
         }
         if (isset($this->customNamespace)) {
-            $data["customNamespace"] = $this->customNamespace;
+            $data->customNamespace = $this->customNamespace;
         }
         if (isset($this->datasource)) {
-            $data["datasource"] = $this->datasource;
+            $data->datasource = $this->datasource;
         }
         if (isset($this->query)) {
-            $data["query"] = $this->query;
+            $data->query = $this->query;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMonitorResource.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMonitorResource.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureMonitorResource.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureMonitorResource.php	2025-04-17 11:10:01.724012041 +0000
@@ -62,26 +62,25 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->subscription)) {
-            $data["subscription"] = $this->subscription;
+            $data->subscription = $this->subscription;
         }
         if (isset($this->resourceGroup)) {
-            $data["resourceGroup"] = $this->resourceGroup;
+            $data->resourceGroup = $this->resourceGroup;
         }
         if (isset($this->resourceName)) {
-            $data["resourceName"] = $this->resourceName;
+            $data->resourceName = $this->resourceName;
         }
         if (isset($this->metricNamespace)) {
-            $data["metricNamespace"] = $this->metricNamespace;
+            $data->metricNamespace = $this->metricNamespace;
         }
         if (isset($this->region)) {
-            $data["region"] = $this->region;
+            $data->region = $this->region;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureResourceGraphQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureResourceGraphQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureResourceGraphQuery.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureResourceGraphQuery.php	2025-04-17 11:10:01.724012041 +0000
@@ -40,17 +40,16 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->query)) {
-            $data["query"] = $this->query;
+            $data->query = $this->query;
         }
         if (isset($this->resultFormat)) {
-            $data["resultFormat"] = $this->resultFormat;
+            $data->resultFormat = $this->resultFormat;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureTracesFilter.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureTracesFilter.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureTracesFilter.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureTracesFilter.php	2025-04-17 11:10:01.724012041 +0000
@@ -47,15 +47,14 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "property" => $this->property,
-            "operation" => $this->operation,
-            "filters" => $this->filters,
-        ];
+        $data = new \stdClass;
+        $data->property = $this->property;
+        $data->operation = $this->operation;
+        $data->filters = $this->filters;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureTracesQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureTracesQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/AzureTracesQuery.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/AzureTracesQuery.php	2025-04-17 11:10:01.724012041 +0000
@@ -86,29 +86,28 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->resultFormat)) {
-            $data["resultFormat"] = $this->resultFormat;
+            $data->resultFormat = $this->resultFormat;
         }
         if (isset($this->resources)) {
-            $data["resources"] = $this->resources;
+            $data->resources = $this->resources;
         }
         if (isset($this->operationId)) {
-            $data["operationId"] = $this->operationId;
+            $data->operationId = $this->operationId;
         }
         if (isset($this->traceTypes)) {
-            $data["traceTypes"] = $this->traceTypes;
+            $data->traceTypes = $this->traceTypes;
         }
         if (isset($this->filters)) {
-            $data["filters"] = $this->filters;
+            $data->filters = $this->filters;
         }
         if (isset($this->query)) {
-            $data["query"] = $this->query;
+            $data->query = $this->query;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BaseGrafanaTemplateVariableQuery.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BaseGrafanaTemplateVariableQuery.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BaseGrafanaTemplateVariableQuery.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BaseGrafanaTemplateVariableQuery.php	2025-04-17 11:10:01.724012041 +0000
@@ -30,14 +30,13 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->rawQuery)) {
-            $data["rawQuery"] = $this->rawQuery;
+            $data->rawQuery = $this->rawQuery;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorColumnsExpression.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorColumnsExpression.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorColumnsExpression.php	2025-04-17 11:10:38.176189241 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorColumnsExpression.php	2025-04-17 11:10:01.724012041 +0000
@@ -36,15 +36,14 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->type = $this->type;
         if (isset($this->columns)) {
-            $data["columns"] = $this->columns;
+            $data->columns = $this->columns;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorFunctionParameterExpression.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorFunctionParameterExpression.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorFunctionParameterExpression.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorFunctionParameterExpression.php	2025-04-17 11:10:01.724012041 +0000
@@ -37,15 +37,14 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "value" => $this->value,
-            "fieldType" => $this->fieldType,
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->value = $this->value;
+        $data->fieldType = $this->fieldType;
+        $data->type = $this->type;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpression.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpression.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpression.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpression.php	2025-04-17 11:10:01.724012041 +0000
@@ -62,23 +62,22 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-        ];
+        $data = new \stdClass;
         if (isset($this->property)) {
-            $data["property"] = $this->property;
+            $data->property = $this->property;
         }
         if (isset($this->interval)) {
-            $data["interval"] = $this->interval;
+            $data->interval = $this->interval;
         }
         if (isset($this->focus)) {
-            $data["focus"] = $this->focus;
+            $data->focus = $this->focus;
         }
         if (isset($this->type)) {
-            $data["type"] = $this->type;
+            $data->type = $this->type;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpressionArray.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpressionArray.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpressionArray.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorGroupByExpressionArray.php	2025-04-17 11:10:01.725012046 +0000
@@ -39,14 +39,13 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "expressions" => $this->expressions,
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->expressions = $this->expressions;
+        $data->type = $this->type;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOperator.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOperator.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOperator.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOperator.php	2025-04-17 11:10:01.725012046 +0000
@@ -40,16 +40,15 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "name" => $this->name,
-            "value" => $this->value,
-        ];
+        $data = new \stdClass;
+        $data->name = $this->name;
+        $data->value = $this->value;
         if (isset($this->labelValue)) {
-            $data["labelValue"] = $this->labelValue;
+            $data->labelValue = $this->labelValue;
         }
         return $data;
     }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpression.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpression.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpression.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpression.php	2025-04-17 11:10:01.725012046 +0000
@@ -41,15 +41,14 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "property" => $this->property,
-            "order" => $this->order,
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->property = $this->property;
+        $data->order = $this->order;
+        $data->type = $this->type;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpressionArray.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpressionArray.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpressionArray.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorOrderByExpressionArray.php	2025-04-17 11:10:01.725012046 +0000
@@ -39,14 +39,13 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "expressions" => $this->expressions,
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->expressions = $this->expressions;
+        $data->type = $this->type;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorProperty.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorProperty.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorProperty.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorProperty.php	2025-04-17 11:10:01.725012046 +0000
@@ -32,14 +32,13 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "type" => $this->type,
-            "name" => $this->name,
-        ];
+        $data = new \stdClass;
+        $data->type = $this->type;
+        $data->name = $this->name;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorPropertyExpression.php /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorPropertyExpression.php
--- /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorPropertyExpression.php	2025-04-17 11:10:38.177189247 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorPropertyExpression.php	2025-04-17 11:10:01.725012046 +0000
@@ -36,14 +36,13 @@
     }
 
     /**
-     * @return array<string, mixed>
+     * @return mixed
      */
-    public function jsonSerialize(): array
+    public function jsonSerialize(): mixed
     {
-        $data = [
-            "property" => $this->property,
-            "type" => $this->type,
-        ];
+        $data = new \stdClass;
+        $data->property = $this->property;
+        $data->type = $this->type;
         return $data;
     }
 }
diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/php/src/Azuremonitor/BuilderQueryEditorReduceExpression.php /tmp...*[Comment body truncated]*

@K-Phoen K-Phoen merged commit 8c9c5b6 into main Apr 17, 2025
10 checks passed
@K-Phoen K-Phoen deleted the php/json-serialize-empty-objects branch April 17, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant