-
Notifications
You must be signed in to change notification settings - Fork 61
Support continuation token in paging #3050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tadelesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")
Auto PR for microsoft/typespec#6242