Merged
Conversation
tadelesh
reviewed
Mar 7, 2025
Member
tadelesh
left a comment
There was a problem hiding this comment.
some concern for the generated code.
...pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_operations.py
Outdated
Show resolved
Hide resolved
...pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_operations.py
Outdated
Show resolved
Hide resolved
...pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_operations.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
PR Overview
This PR implements a safer data extraction mechanism for paging operations by replacing direct dictionary key access with a .get call that provides an empty list as a fallback. It also updates the naming of the continuation token property in the paging metadata.
- Safely handles missing keys in JSON responses by using .get.
- Renames "continuationTokenName" to "nextLinkName" in one of the formatter modules.
Reviewed Changes
| File | Description |
|---|---|
| packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py | Updated extraction of paging elements using .get with default empty list. |
| packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/(aio/)operations/_operations.py | Replaced dictionary indexing with .get for both "value" and "values" keys in async and sync operations. |
| packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py | Same safe-get updates for paging data extraction. |
| packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/(aio/)operations/_operations.py | Updates similar safe extraction for paging with custom base URLs. |
| packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/(aio/)operations/_operations.py | Consistent changes to safely extract paging data in long-running operations. |
| packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomization…/_operations/_operations.py | Similar changes applied to paging extraction and continuation token handling. |
| packages/autorest.python/autorest/m4reformatter/init.py | Changes the paging metadata property name from "continuationTokenName" to "nextLinkName". |
| packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/(aio/)operations/_operations.py | Updated dictionary access for paging elements in the Storage management client. |
Copilot reviewed 40 out of 40 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
packages/autorest.python/autorest/m4reformatter/init.py:553
- The property name change from 'continuationTokenName' to 'nextLinkName' could affect downstream consumers. Please ensure that all corresponding references and documentation are updated accordingly.
operation["continuationTokenName"] = yaml_data["extensions"]["x-ms-pageable"].get("nextLinkName")
tadelesh
reviewed
Mar 13, 2025
...-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_operations.py
Show resolved
Hide resolved
...-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_operations.py
Show resolved
Hide resolved
ChenxiJiang333
approved these changes
Mar 17, 2025
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.
Auto PR for microsoft/typespec#6242