Skip to content

[python] Fix model usage which is referred both in request and response#10117

Merged
msyyc merged 2 commits intomainfrom
python-fix-paging-model
Mar 24, 2026
Merged

[python] Fix model usage which is referred both in request and response#10117
msyyc merged 2 commits intomainfrom
python-fix-paging-model

Conversation

@msyyc
Copy link
Contributor

@msyyc msyyc commented Mar 24, 2026

Context:
When validate mgmt SDK for Azure/azure-rest-api-specs#40286, the following error is reported:
image

Fix model usage for non-paging

When a model is referred by both paging and non-paging operations (i.e., it appears in both request and response), its usage was incorrectly being set to UsageFlags.None. This fix adds an additional check to ensure we only clear usage for models that are exclusively used in paging operations and not also used as input.

Changes

  • packages/http-client-python/emitter/src/code-model.ts: Added a condition to check (type["usage"] & UsageFlags.Input) === 0 before clearing model usage, so models used as input are preserved.

Testing

  • Verified with Kusto management plane spec

@msyyc msyyc changed the title Fix model usage which is referred both in request and response [python] Fix model usage which is referred both in request and response Mar 24, 2026
@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Mar 24, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10117

commit: 4850cf9

@github-actions
Copy link
Contributor

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

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

Fix model usage which is referred both in request and response

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc msyyc enabled auto-merge March 24, 2026 08:21
@msyyc msyyc added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 6004af2 Mar 24, 2026
32 checks passed
@msyyc msyyc deleted the python-fix-paging-model branch March 24, 2026 15:34
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.

3 participants