Skip to content

Support x-keep-typed-in-additional-properties in Python model generator#3665

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

Support x-keep-typed-in-additional-properties in Python model generator#3665
charlie-zhang109 wants to merge 3 commits into
masterfrom
czhang/typed-fields-in-additional-properties

Conversation

@charlie-zhang109

Copy link
Copy Markdown
Contributor

What does this PR do?

When a schema sets x-keep-typed-in-additional-properties: true (introduced in DataDog/datadog-api-spec#5941), the Python model generator emits a _keep_typed_in_additional_properties = True class attribute.

In Python, all fields (typed and untyped) are already stored in _data_store and accessible via both model.python_attr and model["json_key"] syntax — no deserialization change is needed. The class attribute is a marker for tooling and for consistency with other SDK clients.

The first consumer is UsageSummaryDate, UsageSummaryDateOrg, and UsageSummaryResponse.

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.

@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
@datadog-datadog-prod-us1

This comment has been minimized.

@charlie-zhang109 charlie-zhang109 force-pushed the czhang/typed-fields-in-additional-properties branch from 374e0ab to c9ad9e5 Compare June 11, 2026 12:24
charlie-zhang109 and others added 2 commits June 12, 2026 14:01
When a schema sets `x-keep-typed-in-additional-properties: true`, emit a
`_keep_typed_in_additional_properties = True` class attribute. In Python all
fields are already stored in `_data_store` and accessible via `model["key"]`
regardless of type; this marker makes the intent explicit for tooling.

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

In Python, typed fields are already reachable via bracket notation through
_data_store, so no runtime behaviour change is required. The marker makes the
flag visible for introspection and aligns semantics with other language SDKs.

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 c9ad9e5 to eb4e1d0 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