Skip to content

Fix batchendpoint defaults serialisation#47497

Open
ayushhgarg-work wants to merge 4 commits into
Azure:mainfrom
ayushhgarg-work:ayushhgarg/regrbatch
Open

Fix batchendpoint defaults serialisation#47497
ayushhgarg-work wants to merge 4 commits into
Azure:mainfrom
ayushhgarg-work:ayushhgarg/regrbatch

Conversation

@ayushhgarg-work

Copy link
Copy Markdown
Member

Description

Since azure-ai-ml 1.33.0, setting the default deployment on a batch endpoint failed:

endpoint.defaults = {"deployment_name": "my-deployment"}
ml_client.batch_endpoints.begin_create_or_update(endpoint)
# HttpResponseError: Could not find member 'deployment_name'
# on object of type 'BatchEndpointDefaults'.

Root cause: the TypeSpec-generated client stores raw dicts verbatim, so the snake_case key reached the wire instead of deploymentName. When the endpoint had no prior defaults, the call silently no-op'd.

Fix

  • entities/_endpoint/batch_endpoint.py — wrap dict into BatchEndpointDefaults(**...) in _to_rest_batch_endpoint; unwrap back to a snake_case dict in _from_rest_object.
  • _schema/_endpoint/batch/batch_endpoint_defaults.py — YAML @post_load returns a plain snake_case dict for consistency.
  • tests/batch_online_common/unittests/test_endpoint_entity.py — 3 regression tests (camelCase on wire, None stays None, round-trip stays snake_case).
  • CHANGELOG.md — entry under 1.34.0.

Validation

  • 121 passed, 2 skipped in batch unit tests.
  • Live round-trip against sdkv2-20250424-ws: before: Noneafter: {'deployment_name': 'test-deployment-8'}.
image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in azure-ai-ml where BatchEndpoint.defaults supplied as a user dict was being sent to the service with snake_case keys (e.g., deployment_name) instead of the expected wire-format camelCase (deploymentName), causing begin_create_or_update to fail or silently no-op in some cases.

Changes:

  • Wrap BatchEndpoint.defaults dicts into the generated REST model during _to_rest_batch_endpoint serialization so the model emits correct camelCase on the wire.
  • Normalize REST → entity deserialization to expose BatchEndpoint.defaults consistently as a snake_case dict.
  • Add regression unit tests and document the fix in the changelog.

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 Converts defaults dicts to/from generated REST model to ensure correct wire casing and consistent public shape.
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/batch/batch_endpoint_defaults.py Adjusts schema post-load to return a plain dict (snake_case) instead of a REST model instance.
sdk/ml/azure-ai-ml/tests/batch_online_common/unittests/test_endpoint_entity.py Adds unit tests validating wire camelCase serialization and snake_case round-trip behavior.
sdk/ml/azure-ai-ml/CHANGELOG.md Adds a bugfix entry documenting the regression and behavior change.

Comment thread sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/batch_endpoint.py Outdated
Comment thread sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/batch_endpoint.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ayushhgarg-work ayushhgarg-work enabled auto-merge (squash) June 15, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants