Cherrypick- Fix BatchEndpoint.defaults regression: restore attribute-access object from get() - #47931
Merged
Merged
Conversation
Chakradhar886
requested review from
JustinFirsching,
NonStatic2014,
achauhan-scc,
arunsu,
jayesh-tanna,
kingernupur,
nick863,
novaturient95,
rtanase,
sharma-riti and
vivram
as code owners
July 8, 2026 06:06
…c client (#47944) * Fix datastore create TypeError: serialize msrest body for the TypeSpec client (ICM 829788361) az ml datastore create (and MLClient.datastores.create_or_update) failed on azure-ai-ml 1.34.0 with 'TypeError: Object of type Datastore is not JSON serializable'. The datastore operation was migrated to the TypeSpec/arm_ml_service client, whose SdkJSONEncoder only serializes hybrid (_is_model) models, but the datastore entity _to_rest_object() still builds a legacy msrest (v2023_04) Datastore model. json.dumps(model, cls=SdkJSONEncoder) fell through to json.JSONEncoder.default and raised before any HTTP request. Fix: serialize the msrest model to its camelCase wire dict (body=ds_request.serialize()) before passing it to the operation (which accepts Union[Datastore, JSON, IO[bytes]]). Byte-identical to 1.33.0 for all datastore types x credentials (blob/file/adls gen1+2/onelake x none/account-key/ sas/service-principal/certificate), verified offline. The response read path already handles both msrest and hybrid objects. Added a regression test that captures the request body and asserts it serializes cleanly with the client's SdkJSONEncoder; it fails on the unfixed code (reproducing the TypeError) and passes with the fix. The pre-existing test_create only asserted the mocked op was called, so it never exercised serialization. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
saanikaguptamicrosoft
approved these changes
Jul 9, 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.
Cherry-pick of #47813 onto release/azure-ai-ml/1.34.1.
Restores attribute-access object returned from BatchEndpoint.defaults.get() to fix regression.