-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Bug: RecordMergePatchUpdate leaks as public model name in Python SDK
Package
azure-ai-contentunderstanding
Description
The Python SDK exposes RecordMergePatchUpdate as a public model in azure.ai.contentunderstanding.models. This is a synthetic type generated by the TypeSpec Python emitter from MergePatchUpdate<ContentUnderstandingDefaults> — it has no meaningful semantics and should not be part of the public API.
Root Cause
The TypeSpec route definition uses:
updateDefaults is Foundations.Operation<
MergePatchUpdate<ContentUnderstandingDefaults>,
ContentUnderstandingDefaults,
ServiceTraits
>;ContentUnderstandingDefaults has a single field modelDeployments: Record<string>. The Python emitter generates a synthetic model RecordMergePatchUpdate for the merge-patch body type, which is effectively just Dict[str, str].
What the user sees
- In
models/__init__.py:RecordMergePatchUpdateis exported as a public type - In method signatures (generated
_operations.py):def update_defaults( self, *, model_deployments: Optional[RecordMergePatchUpdate] = None, ... )
- In docstrings:
:paramtype model_deployments: ~azure.ai.contentunderstanding.models.RecordMergePatchUpdate - In
_models.py: An empty class with no fields:class RecordMergePatchUpdate(_Model): """RecordMergePatchUpdate."""
Current Workaround
In models/_patch.py, we alias it to Dict[str, str]:
RecordMergePatchUpdate = Dict[str, str]This makes it work at runtime, but the name still appears in IDE tooltips, documentation, and APIView.
Expected Behavior
The emitter should resolve MergePatchUpdate<T> where T has a single Record<string> field to Dict[str, str] directly, rather than generating a synthetic model class. At minimum, the generated method signatures should use Dict[str, str] instead of RecordMergePatchUpdate.
Affected Files (generated)
azure/ai/contentunderstanding/_operations/_operations.py— sync method signatures and docstringsazure/ai/contentunderstanding/aio/_operations/_operations.py— async method signatures and docstringsazure/ai/contentunderstanding/models/_models.py— empty model class definition
Environment
- TypeSpec commit:
2b2d493e2e883fcf474b3554839d97d1b5be1604 - Repo:
Azure/azure-sdk-for-python, branchcu_sdk/ga - PR: Content Understanding GA SDK for Python #45092