Fix BatchEndpoint.defaults regression: restore attribute-access object from get()#47813
Merged
ayushhgarg-work merged 4 commits intoJul 6, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a regression in azure-ai-ml where ml_client.batch_endpoints.get() could return BatchEndpoint.defaults as None/dict, breaking existing sample and user code that relies on attribute access (e.g., endpoint.defaults.deployment_name = ...). The intent is to restore an attribute-accessible defaults object while keeping correct camelCase serialization on the wire.
Changes:
- Restores
BatchEndpoint.defaultsto be an attribute-accessible object after_from_rest_object(instead of dict/None). - Updates the batch endpoint defaults marshmallow schema to return a
BatchEndpointDefaultsobject post-load. - Replaces the prior dict/
Nonetest assertion with regression tests for attribute access and camelCase round-tripping.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/batch_endpoint.py | Changes _from_rest_object behavior for defaults to preserve attribute access. |
| sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/batch/batch_endpoint_defaults.py | Adjusts schema post-load to construct a BatchEndpointDefaults object. |
| sdk/ml/azure-ai-ml/tests/batch_online_common/unittests/test_endpoint_entity.py | Updates unit tests to guard attribute access + correct camelCase serialization round-trip. |
| sdk/ml/azure-ai-ml/CHANGELOG.md | Updates changelog entry to reflect the restored attribute-access behavior for get(). |
achauhan-scc
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #47497. That PR fixed
BatchEndpoint.defaultssnake_case serialization, butalso changed
batch_endpoints.get()to returnendpoint.defaultsas a dict/Noneinsteadof a
BatchEndpointDefaultsobject. This broke the published batch sample notebooks, whichdo:
On an endpoint with no defaults,
endpoint.defaultsbecameNone, soendpoint.defaults.deployment_name = ...raised:AttributeError: 'NoneType' object has no attribute 'deployment_name'.8 batch-endpoint samples failed on the release branch.
Fix
_from_rest_objectagain returns theBatchEndpointDefaultsobject (attribute get/set works)._schema/.../batch_endpoint_defaults.py@post_loadagain returns the object._to_rest_batch_endpoint(dict → camelCase wire format), whichis what actually resolved BatchEndpoint defaults serialization regression - deployment_name not converted to camelCase on wire #47478. Round-tripping still serializes correctly.
Tests
attribute access from
get(), and the full sample flow (mutate.deployment_name→ re-serialize→ asserts
{"deploymentName": ...}).11 passedintests/batch_online_common/unittests/test_endpoint_entity.py.