Skip to content

[python][bug] compatible logic for flatten doesn't work for model initialization #8994

@msyyc

Description

@msyyc

Python SDK models support three operations: initialization, getting attributes, and setting attributes. The Python team implemented compatibility mechanisms to preserve attribute getter/setter behavior.

# Before TypeSpec migration
model = Key(kty=...)
model.kty = "..."   # Set attribute
print(model.kty)    # Get attribute

# After TypeSpec migration - Initialization (Breaking Change)
model = Key(kty=...)                              # ❌ No longer supported
model = Key(properties=KeyProperties(kty=...))    # ✅ New required structure

# After TypeSpec migration - Attribute access (Backward Compatible)
model.kty = "..."                                 # ✅ Still works
print(model.kty)                                  # ✅ Still works

# After TypeSpec migration - Recommended approach
model.properties.kty = "..."                      # ✅ Recommended
print(model.properties.kty)                       # ✅ Recommended

Metadata

Metadata

Assignees

Labels

emitter:client:pythonIssue for the Python client emitter: @typespec/http-client-python

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions