Skip to content

Commit 029b9fb

Browse files
Support x-keep-typed-in-additional-properties in Python model generator
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>
1 parent 06f047a commit 029b9fb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

.generator/src/generator/templates/model_generic.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ class {{ name }}(ModelNormal):
7474
{%- if model.nullable %}
7575
_nullable = True
7676
{%- endif %}
77+
{%- if model.get("x-keep-typed-in-additional-properties") %}
78+
_keep_typed_in_additional_properties = True
79+
{%- endif %}
7780

7881
{%- if model.properties %}
7982
@cached_property

0 commit comments

Comments
 (0)