From 0bc3efc1a2e3a221a29652cdcb6db089f773f15d Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 21:32:16 +0000 Subject: [PATCH] Allow for any type for additionalProperties in HTTPLogItem (#2742) * handle untyped additionalproperties * Regenerate client from commit 37070fd4 of spec repo --------- Co-authored-by: Kevin Zou Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 ++++---- .generator/schemas/v2/openapi.yaml | 1 - .generator/src/generator/formatter.py | 2 ++ api/datadogV2/model_http_log_item.go | 4 ++-- examples/v2/logs/SubmitLog.go | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index c7a85264a59..6538c86a733 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-17 14:10:54.976689", - "spec_repo_commit": "fb024a45" + "regenerated": "2024-10-18 21:00:51.408686", + "spec_repo_commit": "37070fd4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-17 14:10:54.995137", - "spec_repo_commit": "fb024a45" + "regenerated": "2024-10-18 21:00:51.427778", + "spec_repo_commit": "37070fd4" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6efc200303c..db36354cca9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9917,7 +9917,6 @@ components: HTTPLogItem: additionalProperties: description: Additional log attributes. - type: string description: Logs that are sent over HTTP. properties: ddsource: diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index 01611c4039c..ab118cfd235 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -640,6 +640,8 @@ def format_data_with_schema_dict( nested_schema_name = schema_name(nested_schema) if nested_schema_name: nested_schema_name = name_prefix + nested_schema_name + elif nested_schema.get("type") is None: + nested_schema_name = "interface{}" has_properties = schema.get("properties") diff --git a/api/datadogV2/model_http_log_item.go b/api/datadogV2/model_http_log_item.go index 0c2d1af86b0..d29b59b6b79 100644 --- a/api/datadogV2/model_http_log_item.go +++ b/api/datadogV2/model_http_log_item.go @@ -30,7 +30,7 @@ type HTTPLogItem struct { Service *string `json:"service,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]string `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` } // NewHTTPLogItem instantiates a new HTTPLogItem object. @@ -227,7 +227,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { if all.Message == nil { return fmt.Errorf("required field message missing") } - additionalProperties := make(map[string]string) + additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"ddsource", "ddtags", "hostname", "message", "service"}) } else { diff --git a/examples/v2/logs/SubmitLog.go b/examples/v2/logs/SubmitLog.go index 9f24097b2bd..c147b90e3be 100644 --- a/examples/v2/logs/SubmitLog.go +++ b/examples/v2/logs/SubmitLog.go @@ -20,7 +20,7 @@ func main() { Hostname: datadog.PtrString("i-012345678"), Message: "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World", Service: datadog.PtrString("payment"), - AdditionalProperties: map[string]string{ + AdditionalProperties: map[string]interface{}{ "status": "info", }, },