Skip to content

[pull] master from DataDog:master#416

Merged
pull[bot] merged 4 commits into
ConnectionMaster:masterfrom
DataDog:master
Jun 30, 2026
Merged

[pull] master from DataDog:master#416
pull[bot] merged 4 commits into
ConnectionMaster:masterfrom
DataDog:master

Conversation

@pull

@pull pull Bot commented Jun 30, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
…3500)

* fix: copy typed fields to additional_properties in build_from_hash

build_from_hash (used by the API client deserializer) only routed
unknown fields to additional_properties; typed fields were set via
their accessors but never mirrored into the AP hash.  initialize()
already has the per-field copy, but build_from_hash calls new() with
no args so that copy ran against an empty attributes hash.

Add a loop in build_from_hash that copies each typed field that was
present in the JSON attributes into additional_properties after
deserialization, matching the behaviour of initialize().  Applied to
both v1 and v2 model_base.rb.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: update model_base.j2 template and add deserialization tests

- Apply same build_from_hash typed-fields-to-additional_properties fix to
  the generator template so regenerated files stay correct
- Add two unit tests for the new behavior using UsageSummaryResponse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: use symbol keys in tests and replace each_with_object dead code

- Test hashes now use symbol keys to match what the real API client
  passes after JSON.parse(..., symbolize_names: true)
- Replace each_with_object({}) (accumulator never written) with plain
  each in v1/v2 model_base.rb and the generator template

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: store raw attribute values in additional_properties instead of deserialized objects

The previous approach stored `self.send(key)` (the deserialized Ruby object,
potentially an `UnparsedObject`) into `additional_properties`. The generated
`to_hash` in models with additional_properties then outputs AP values without
calling `_to_hash`, overwriting the correctly-converted typed field values with
raw Ruby objects. This caused `lookup` traversal to encounter `UnparsedObject`
instead of a plain Hash when accessing nested fields, raising NoMethodError.

Store `attributes[json_key]` (the raw JSON value) instead, matching what
`initialize` already does for unknown fields. This preserves AP accessibility
for typed fields while keeping `to_hash` output correct.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: mirror typed fields into additional_properties only for x-keep-typed-in-additional-properties models

Reverts the generic model_base.rb approach (which broke pagination by
overwriting cursor updates with stale AP values) and instead adds a
build_from_hash override only in models that declare
x-keep-typed-in-additional-properties. The override calls super to set
typed fields, then mirrors them into additional_properties via a
json_key loop — matching the existing initialize pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
@pull pull Bot locked and limited conversation to collaborators Jun 30, 2026
@pull pull Bot added the ⤵️ pull label Jun 30, 2026
@pull pull Bot merged commit 81a7b8e into ConnectionMaster:master Jun 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant