Skip to content

[Python] Fix for optional properties in flatten model to keep compatibility#9129

Merged
msyyc merged 2 commits intomainfrom
python-fix-optional-properties
Dec 4, 2025
Merged

[Python] Fix for optional properties in flatten model to keep compatibility#9129
msyyc merged 2 commits intomainfrom
python-fix-optional-properties

Conversation

@msyyc
Copy link
Contributor

@msyyc msyyc commented Dec 3, 2025

fix #9004

The underlying issue arises because when properties is optional, _class_type becomes wrapped twice by functools.partial, necessitating an additional unwrapping step to obtain the actual type rather than the wrapped class.

I have included a test case in this pull request to address a similar situation.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 3, 2025

Open in StackBlitz

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http@9129
npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client@9129

commit: 8a7cff7

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

@typespec/http-client-python - fix ✏️

Fix for optional properties in flatten model to keep compatibility

@msyyc msyyc added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Dec 3, 2025
@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc msyyc marked this pull request as ready for review December 3, 2025 09:20
@msyyc msyyc added this pull request to the merge queue Dec 4, 2025
Merged via the queue into main with commit 7b47584 Dec 4, 2025
38 checks passed
@msyyc msyyc deleted the python-fix-optional-properties branch December 4, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI meets output breaking when migrate to new SDK generated from Typespec

3 participants