Skip to content

Support _keepTypedInAdditionalProperties for UsageSummary models#4427

Closed
charlie-zhang109 wants to merge 6 commits into
masterfrom
czhang/typed-fields-in-additional-properties
Closed

Support _keepTypedInAdditionalProperties for UsageSummary models#4427
charlie-zhang109 wants to merge 6 commits into
masterfrom
czhang/typed-fields-in-additional-properties

Conversation

@charlie-zhang109

Copy link
Copy Markdown

What does this PR do?

Adds static readonly _keepTypedInAdditionalProperties = true to UsageSummaryDate, UsageSummaryDateOrg, and UsageSummaryResponse (the spec flag comes from DataDog/datadog-api-spec#5941).

Updates ObjectSerializer.ts (v1 + v2) to check this flag during deserialization: when set, ALL JSON keys (not just unknown ones) are included in extraAttributes and therefore in additionalProperties. Previously, only keys absent from attributesBaseNames reached that map.

Note: ObjectSerializer.ts is auto-generated. This PR patches the generated file directly to demonstrate the intended behavior; the upstream generator also needs to be updated to emit the keepAllInAdditional guard for flagged models so the change survives regeneration.

Companion PRs:

Review checklist

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

charlie-zhang109

This comment was marked as resolved.

@datadog-prod-us1-6

This comment has been minimized.

charlie-zhang109

This comment was marked as resolved.

@charlie-zhang109 charlie-zhang109 marked this pull request as ready for review June 8, 2026 15:23
@charlie-zhang109 charlie-zhang109 requested review from a team as code owners June 8, 2026 15:23
@charlie-zhang109 charlie-zhang109 force-pushed the czhang/typed-fields-in-additional-properties branch from dda0434 to f38fe31 Compare June 11, 2026 12:25
charlie-zhang109 and others added 4 commits June 12, 2026 14:01
Add a static `_keepTypedInAdditionalProperties = true` flag to UsageSummaryDate,
UsageSummaryDateOrg, and UsageSummaryResponse. Update ObjectSerializer (v1 + v2)
to include typed keys in additionalProperties when a model sets this flag, giving
a single unified access pattern for all fields.

Note: ObjectSerializer is auto-generated; the upstream generator also needs
updating to emit the keepAllInAdditional guard for flagged models.

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

When _keepTypedInAdditionalProperties is true, known typed attributes are now
deserialized with their declared type/format before being stored in
additionalProperties. This routes int64 fields through the BigInt conversion
path instead of raw JSON number assignment. Also removes the redundant
instance.additionalProperties initialization guard that was immediately
overwritten.

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

Previously the keepAllInAdditional path rebuilt a baseNameToAttr reverse map
inside the conditional on every deserialization call. Hoisting it to a single
combined loop halves the attributesMap iterations per call for flagged models.

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

baseNameToAttr was conditionally set to null when keepAllInAdditional is false,
which fails under strict: true. Always initialize to {} and skip population via
the existing keepAllInAdditional guard in the loop body.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@charlie-zhang109 charlie-zhang109 force-pushed the czhang/typed-fields-in-additional-properties branch from fe7b571 to 4749b02 Compare June 12, 2026 18:01
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