Skip to content

Commit

Permalink
Ensure clients can handle empty oneOf objects (#2702)
Browse files Browse the repository at this point in the history
* handle empty oneof

* handle empty object matches

* lint

* Regenerate client from commit 60bc9127 of spec repo

---------

Co-authored-by: Sherzod Karimov <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent 46c520f commit 2de9c6c
Show file tree
Hide file tree
Showing 40 changed files with 177 additions and 53 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-30 13:56:52.513837",
"spec_repo_commit": "eb66b1cf"
"regenerated": "2024-09-30 14:37:39.238144",
"spec_repo_commit": "60bc9127"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-30 13:56:52.527994",
"spec_repo_commit": "eb66b1cf"
"regenerated": "2024-09-30 14:37:39.252667",
"spec_repo_commit": "60bc9127"
}
}
}
2 changes: 1 addition & 1 deletion .generator/src/generator/templates/model_oneof.j2
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (obj *{{ name }}) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.{{ attributeName }} != nil {% if oneOf.get("type", "object") == "object" %}&& obj.{{ attributeName }}.UnparsedObject == nil {% endif %}{
json{{ attributeName }}, _ := datadog.Marshal(obj.{{ attributeName }})
if string(json{{ attributeName }}) == "{}" { // empty struct
if string(json{{ attributeName }}) == "{}"{% if not oneOf|is_primitive and not oneOf.required %} && string(data) != "{}" {% endif %} { // empty struct
obj.{{ attributeName }} = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV1/model_distribution_point_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (obj *DistributionPointItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.DistributionPointData != nil {
jsonDistributionPointData, _ := datadog.Marshal(obj.DistributionPointData)
if string(jsonDistributionPointData) == "{}" { // empty struct
if string(jsonDistributionPointData) == "{}" && string(data) != "{}" { // empty struct
obj.DistributionPointData = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV1/model_shared_dashboard_invites_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (obj *SharedDashboardInvitesData) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.SharedDashboardInvitesDataList != nil {
jsonSharedDashboardInvitesDataList, _ := datadog.Marshal(obj.SharedDashboardInvitesDataList)
if string(jsonSharedDashboardInvitesDataList) == "{}" { // empty struct
if string(jsonSharedDashboardInvitesDataList) == "{}" && string(data) != "{}" { // empty struct
obj.SharedDashboardInvitesDataList = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV1/model_widget_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (obj *WidgetTime) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.WidgetLegacyLiveSpan != nil && obj.WidgetLegacyLiveSpan.UnparsedObject == nil {
jsonWidgetLegacyLiveSpan, _ := datadog.Marshal(obj.WidgetLegacyLiveSpan)
if string(jsonWidgetLegacyLiveSpan) == "{}" { // empty struct
if string(jsonWidgetLegacyLiveSpan) == "{}" && string(data) != "{}" { // empty struct
obj.WidgetLegacyLiveSpan = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_api_key_response_included_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *APIKeyResponseIncludedItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (obj *ApplicationKeyResponseIncludedItem) UnmarshalJSON(data []byte) error
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_auth_n_mapping_included.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (obj *AuthNMappingIncluded) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.AuthNMappingTeam != nil && obj.AuthNMappingTeam.UnparsedObject == nil {
jsonAuthNMappingTeam, _ := datadog.Marshal(obj.AuthNMappingTeam)
if string(jsonAuthNMappingTeam) == "{}" { // empty struct
if string(jsonAuthNMappingTeam) == "{}" && string(data) != "{}" { // empty struct
obj.AuthNMappingTeam = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_ci_app_aggregate_bucket_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (obj *CIAppAggregateBucketValue) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.CIAppAggregateBucketValueTimeseries != nil {
jsonCIAppAggregateBucketValueTimeseries, _ := datadog.Marshal(obj.CIAppAggregateBucketValueTimeseries)
if string(jsonCIAppAggregateBucketValueTimeseries) == "{}" { // empty struct
if string(jsonCIAppAggregateBucketValueTimeseries) == "{}" && string(data) != "{}" { // empty struct
obj.CIAppAggregateBucketValueTimeseries = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_container_image_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *ContainerImageItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.ContainerImage != nil && obj.ContainerImage.UnparsedObject == nil {
jsonContainerImage, _ := datadog.Marshal(obj.ContainerImage)
if string(jsonContainerImage) == "{}" { // empty struct
if string(jsonContainerImage) == "{}" && string(data) != "{}" { // empty struct
obj.ContainerImage = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *ContainerImageItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.ContainerImageGroup != nil && obj.ContainerImageGroup.UnparsedObject == nil {
jsonContainerImageGroup, _ := datadog.Marshal(obj.ContainerImageGroup)
if string(jsonContainerImageGroup) == "{}" { // empty struct
if string(jsonContainerImageGroup) == "{}" && string(data) != "{}" { // empty struct
obj.ContainerImageGroup = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_container_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *ContainerItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.Container != nil && obj.Container.UnparsedObject == nil {
jsonContainer, _ := datadog.Marshal(obj.Container)
if string(jsonContainer) == "{}" { // empty struct
if string(jsonContainer) == "{}" && string(data) != "{}" { // empty struct
obj.Container = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *ContainerItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.ContainerGroup != nil && obj.ContainerGroup.UnparsedObject == nil {
jsonContainerGroup, _ := datadog.Marshal(obj.ContainerGroup)
if string(jsonContainerGroup) == "{}" { // empty struct
if string(jsonContainerGroup) == "{}" && string(data) != "{}" { // empty struct
obj.ContainerGroup = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_downtime_response_included_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *DowntimeResponseIncludedItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *DowntimeResponseIncludedItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.DowntimeMonitorIncludedItem != nil && obj.DowntimeMonitorIncludedItem.UnparsedObject == nil {
jsonDowntimeMonitorIncludedItem, _ := datadog.Marshal(obj.DowntimeMonitorIncludedItem)
if string(jsonDowntimeMonitorIncludedItem) == "{}" { // empty struct
if string(jsonDowntimeMonitorIncludedItem) == "{}" && string(data) != "{}" { // empty struct
obj.DowntimeMonitorIncludedItem = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_downtime_schedule_create_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (obj *DowntimeScheduleCreateRequest) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil && obj.DowntimeScheduleOneTimeCreateUpdateRequest.UnparsedObject == nil {
jsonDowntimeScheduleOneTimeCreateUpdateRequest, _ := datadog.Marshal(obj.DowntimeScheduleOneTimeCreateUpdateRequest)
if string(jsonDowntimeScheduleOneTimeCreateUpdateRequest) == "{}" { // empty struct
if string(jsonDowntimeScheduleOneTimeCreateUpdateRequest) == "{}" && string(data) != "{}" { // empty struct
obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_downtime_schedule_update_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *DowntimeScheduleUpdateRequest) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.DowntimeScheduleRecurrencesUpdateRequest != nil && obj.DowntimeScheduleRecurrencesUpdateRequest.UnparsedObject == nil {
jsonDowntimeScheduleRecurrencesUpdateRequest, _ := datadog.Marshal(obj.DowntimeScheduleRecurrencesUpdateRequest)
if string(jsonDowntimeScheduleRecurrencesUpdateRequest) == "{}" { // empty struct
if string(jsonDowntimeScheduleRecurrencesUpdateRequest) == "{}" && string(data) != "{}" { // empty struct
obj.DowntimeScheduleRecurrencesUpdateRequest = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *DowntimeScheduleUpdateRequest) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.DowntimeScheduleOneTimeCreateUpdateRequest != nil && obj.DowntimeScheduleOneTimeCreateUpdateRequest.UnparsedObject == nil {
jsonDowntimeScheduleOneTimeCreateUpdateRequest, _ := datadog.Marshal(obj.DowntimeScheduleOneTimeCreateUpdateRequest)
if string(jsonDowntimeScheduleOneTimeCreateUpdateRequest) == "{}" { // empty struct
if string(jsonDowntimeScheduleOneTimeCreateUpdateRequest) == "{}" && string(data) != "{}" { // empty struct
obj.DowntimeScheduleOneTimeCreateUpdateRequest = nil
} else {
match++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (obj *IncidentAttachmentsResponseIncludedItem) UnmarshalJSON(data []byte) e
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_incident_field_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *IncidentFieldAttributes) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.IncidentFieldAttributesSingleValue != nil && obj.IncidentFieldAttributesSingleValue.UnparsedObject == nil {
jsonIncidentFieldAttributesSingleValue, _ := datadog.Marshal(obj.IncidentFieldAttributesSingleValue)
if string(jsonIncidentFieldAttributesSingleValue) == "{}" { // empty struct
if string(jsonIncidentFieldAttributesSingleValue) == "{}" && string(data) != "{}" { // empty struct
obj.IncidentFieldAttributesSingleValue = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *IncidentFieldAttributes) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.IncidentFieldAttributesMultipleValue != nil && obj.IncidentFieldAttributesMultipleValue.UnparsedObject == nil {
jsonIncidentFieldAttributesMultipleValue, _ := datadog.Marshal(obj.IncidentFieldAttributesMultipleValue)
if string(jsonIncidentFieldAttributesMultipleValue) == "{}" { // empty struct
if string(jsonIncidentFieldAttributesMultipleValue) == "{}" && string(data) != "{}" { // empty struct
obj.IncidentFieldAttributesMultipleValue = nil
} else {
match++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (obj *IncidentIntegrationMetadataResponseIncludedItem) UnmarshalJSON(data [
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_incident_response_included_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *IncidentResponseIncludedItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_incident_service_included_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (obj *IncidentServiceIncludedItems) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_incident_team_included_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (obj *IncidentTeamIncludedItems) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (obj *IncidentTodoResponseIncludedItem) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.User != nil && obj.User.UnparsedObject == nil {
jsonUser, _ := datadog.Marshal(obj.User)
if string(jsonUser) == "{}" { // empty struct
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
obj.User = nil
} else {
match++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (obj *ListEntityCatalogResponseIncludedItem) UnmarshalJSON(data []byte) err
if err == nil {
if obj.EntityResponseIncludedSchema != nil && obj.EntityResponseIncludedSchema.UnparsedObject == nil {
jsonEntityResponseIncludedSchema, _ := datadog.Marshal(obj.EntityResponseIncludedSchema)
if string(jsonEntityResponseIncludedSchema) == "{}" { // empty struct
if string(jsonEntityResponseIncludedSchema) == "{}" && string(data) != "{}" { // empty struct
obj.EntityResponseIncludedSchema = nil
} else {
match++
Expand All @@ -71,7 +71,7 @@ func (obj *ListEntityCatalogResponseIncludedItem) UnmarshalJSON(data []byte) err
if err == nil {
if obj.EntityResponseIncludedRawSchema != nil && obj.EntityResponseIncludedRawSchema.UnparsedObject == nil {
jsonEntityResponseIncludedRawSchema, _ := datadog.Marshal(obj.EntityResponseIncludedRawSchema)
if string(jsonEntityResponseIncludedRawSchema) == "{}" { // empty struct
if string(jsonEntityResponseIncludedRawSchema) == "{}" && string(data) != "{}" { // empty struct
obj.EntityResponseIncludedRawSchema = nil
} else {
match++
Expand All @@ -88,7 +88,7 @@ func (obj *ListEntityCatalogResponseIncludedItem) UnmarshalJSON(data []byte) err
if err == nil {
if obj.EntityResponseIncludedRelatedEntity != nil && obj.EntityResponseIncludedRelatedEntity.UnparsedObject == nil {
jsonEntityResponseIncludedRelatedEntity, _ := datadog.Marshal(obj.EntityResponseIncludedRelatedEntity)
if string(jsonEntityResponseIncludedRelatedEntity) == "{}" { // empty struct
if string(jsonEntityResponseIncludedRelatedEntity) == "{}" && string(data) != "{}" { // empty struct
obj.EntityResponseIncludedRelatedEntity = nil
} else {
match++
Expand All @@ -105,7 +105,7 @@ func (obj *ListEntityCatalogResponseIncludedItem) UnmarshalJSON(data []byte) err
if err == nil {
if obj.EntityResponseIncludedOncall != nil && obj.EntityResponseIncludedOncall.UnparsedObject == nil {
jsonEntityResponseIncludedOncall, _ := datadog.Marshal(obj.EntityResponseIncludedOncall)
if string(jsonEntityResponseIncludedOncall) == "{}" { // empty struct
if string(jsonEntityResponseIncludedOncall) == "{}" && string(data) != "{}" { // empty struct
obj.EntityResponseIncludedOncall = nil
} else {
match++
Expand All @@ -122,7 +122,7 @@ func (obj *ListEntityCatalogResponseIncludedItem) UnmarshalJSON(data []byte) err
if err == nil {
if obj.EntityResponseIncludedIncident != nil && obj.EntityResponseIncludedIncident.UnparsedObject == nil {
jsonEntityResponseIncludedIncident, _ := datadog.Marshal(obj.EntityResponseIncludedIncident)
if string(jsonEntityResponseIncludedIncident) == "{}" { // empty struct
if string(jsonEntityResponseIncludedIncident) == "{}" && string(data) != "{}" { // empty struct
obj.EntityResponseIncludedIncident = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_logs_aggregate_bucket_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (obj *LogsAggregateBucketValue) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.LogsAggregateBucketValueTimeseries != nil {
jsonLogsAggregateBucketValueTimeseries, _ := datadog.Marshal(obj.LogsAggregateBucketValueTimeseries)
if string(jsonLogsAggregateBucketValueTimeseries) == "{}" { // empty struct
if string(jsonLogsAggregateBucketValueTimeseries) == "{}" && string(data) != "{}" { // empty struct
obj.LogsAggregateBucketValueTimeseries = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_metric_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *MetricVolumes) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.MetricDistinctVolume != nil && obj.MetricDistinctVolume.UnparsedObject == nil {
jsonMetricDistinctVolume, _ := datadog.Marshal(obj.MetricDistinctVolume)
if string(jsonMetricDistinctVolume) == "{}" { // empty struct
if string(jsonMetricDistinctVolume) == "{}" && string(data) != "{}" { // empty struct
obj.MetricDistinctVolume = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *MetricVolumes) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.MetricIngestedIndexedVolume != nil && obj.MetricIngestedIndexedVolume.UnparsedObject == nil {
jsonMetricIngestedIndexedVolume, _ := datadog.Marshal(obj.MetricIngestedIndexedVolume)
if string(jsonMetricIngestedIndexedVolume) == "{}" { // empty struct
if string(jsonMetricIngestedIndexedVolume) == "{}" && string(data) != "{}" { // empty struct
obj.MetricIngestedIndexedVolume = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_metrics_and_metric_tag_configurations.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *MetricsAndMetricTagConfigurations) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.Metric != nil && obj.Metric.UnparsedObject == nil {
jsonMetric, _ := datadog.Marshal(obj.Metric)
if string(jsonMetric) == "{}" { // empty struct
if string(jsonMetric) == "{}" && string(data) != "{}" { // empty struct
obj.Metric = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *MetricsAndMetricTagConfigurations) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.MetricTagConfiguration != nil && obj.MetricTagConfiguration.UnparsedObject == nil {
jsonMetricTagConfiguration, _ := datadog.Marshal(obj.MetricTagConfiguration)
if string(jsonMetricTagConfiguration) == "{}" { // empty struct
if string(jsonMetricTagConfiguration) == "{}" && string(data) != "{}" { // empty struct
obj.MetricTagConfiguration = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_monitor_config_policy_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (obj *MonitorConfigPolicyPolicy) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.MonitorConfigPolicyTagPolicy != nil && obj.MonitorConfigPolicyTagPolicy.UnparsedObject == nil {
jsonMonitorConfigPolicyTagPolicy, _ := datadog.Marshal(obj.MonitorConfigPolicyTagPolicy)
if string(jsonMonitorConfigPolicyTagPolicy) == "{}" { // empty struct
if string(jsonMonitorConfigPolicyTagPolicy) == "{}" && string(data) != "{}" { // empty struct
obj.MonitorConfigPolicyTagPolicy = nil
} else {
match++
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_rum_aggregate_bucket_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (obj *RUMAggregateBucketValue) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.RUMAggregateBucketValueTimeseries != nil {
jsonRUMAggregateBucketValueTimeseries, _ := datadog.Marshal(obj.RUMAggregateBucketValueTimeseries)
if string(jsonRUMAggregateBucketValueTimeseries) == "{}" { // empty struct
if string(jsonRUMAggregateBucketValueTimeseries) == "{}" && string(data) != "{}" { // empty struct
obj.RUMAggregateBucketValueTimeseries = nil
} else {
match++
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_scalar_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (obj *ScalarColumn) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.GroupScalarColumn != nil && obj.GroupScalarColumn.UnparsedObject == nil {
jsonGroupScalarColumn, _ := datadog.Marshal(obj.GroupScalarColumn)
if string(jsonGroupScalarColumn) == "{}" { // empty struct
if string(jsonGroupScalarColumn) == "{}" && string(data) != "{}" { // empty struct
obj.GroupScalarColumn = nil
} else {
match++
Expand All @@ -53,7 +53,7 @@ func (obj *ScalarColumn) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.DataScalarColumn != nil && obj.DataScalarColumn.UnparsedObject == nil {
jsonDataScalarColumn, _ := datadog.Marshal(obj.DataScalarColumn)
if string(jsonDataScalarColumn) == "{}" { // empty struct
if string(jsonDataScalarColumn) == "{}" && string(data) != "{}" { // empty struct
obj.DataScalarColumn = nil
} else {
match++
Expand Down
Loading

0 comments on commit 2de9c6c

Please sign in to comment.