Skip to content

Text translation v2 ga#46435

Open
jrjrguo wants to merge 4 commits intoAzure:mainfrom
jrjrguo:text-translation-v2-ga
Open

Text translation v2 ga#46435
jrjrguo wants to merge 4 commits intoAzure:mainfrom
jrjrguo:text-translation-v2-ga

Conversation

@jrjrguo
Copy link
Copy Markdown
Member

@jrjrguo jrjrguo commented Apr 21, 2026

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings April 21, 2026 00:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates azure-ai-translation-text for the v2 GA release, including moving to the stable Translator API version and aligning the package surface area (models, enums, client initialization, and test recordings) with the GA contract.

Changes:

  • Promote the package to 2.0.0 GA and switch defaults to api-version 2026-06-06.
  • Update the public model surface (remove grade, add TranslationTone / TranslationGender enums and types).
  • Simplify client construction/auth plumbing and adjust tests/recording matching to be resilient across api-version changes.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/translation/azure-ai-translation-text/tsp-location.yaml Bumps the TypeSpec/spec commit reference used for generation.
sdk/translation/azure-ai-translation-text/tests/conftest.py Adjusts test-proxy request matching to ignore api-version.
sdk/translation/azure-ai-translation-text/pyproject.toml Moves classifier to Stable and bumps azure-core minimum.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/models/_models.py Updates docstrings/types; removes grade; adds tone/gender typing.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/models/_enums.py Adds TranslationTone and TranslationGender enums.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/models/init.py Exports newly added enums.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_patch.py Refactors sync convenience client to new init/auth/header policy approach.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/aio/_patch.py Refactors async convenience client similarly.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_configuration.py Adds credential to config and infers auth policy when present.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/aio/_configuration.py Async counterpart of config/auth inference changes.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_client.py Generated sync client now accepts credential and passes into configuration.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/aio/_client.py Generated async client now accepts credential similarly.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_operations/_operations.py Updates default api-version and stream handling (decompress / iter_raw).
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/aio/_operations/_operations.py Async operations: same api-version + streaming adjustments.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_utils/serialization.py Removes eval usage for basic types; explicit conversions.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_utils/model_base.py Enhances (de)serialization behaviors and mutable deserialization caching.
sdk/translation/azure-ai-translation-text/apiview-properties.json Adds APIView namespace mappings for the new enums.
sdk/translation/azure-ai-translation-text/_metadata.json Updates metadata to stable api-version and adds apiVersions map.
sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_version.py Bumps package version from 2.0.0b1 to 2.0.0.
sdk/translation/azure-ai-translation-text/CHANGELOG.md Adds 2.0.0 GA entry and documents breaking change/removals.

Comment on lines +816 to +821
def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool:
return (
isinstance(deserializer, functools.partial)
and isinstance(deserializer.args[0], functools.partial)
and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
)
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

_is_array_encoded_deserializer appears to never match the deserializer produced by get_deserializer for array-encoded strings. get_deserializer returns functools.partial(_deserialize_array_encoded, <delimiter>) (whose first arg is a str), but _is_array_encoded_deserializer checks that deserializer.args[0] is itself a functools.partial, so the encoded-string path in _deserialize_sequence won’t trigger and string inputs may be incorrectly treated as iterables. Consider changing the detection to check getattr(deserializer, "func", None) is _deserialize_array_encoded (and likewise for the union case).

Copilot uses AI. Check for mistakes.
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.

2 participants