Skip to content

Conversation

@msyyc
Copy link
Member

@msyyc msyyc commented Mar 4, 2025

@msyyc msyyc changed the title Auto PR for https://github.com/microsoft/typespec/pull/6242 Support continuation token in paging Mar 7, 2025
@msyyc msyyc marked this pull request as ready for review March 7, 2025 04:40
Copy link
Member

@tadelesh tadelesh left a 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.

@msyyc msyyc requested review from Copilot and tadelesh March 10, 2025 03:59
Copy link

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.

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")

@msyyc msyyc requested a review from tadelesh March 13, 2025 10:56
@msyyc msyyc enabled auto-merge (squash) March 17, 2025 10:05
@msyyc msyyc merged commit eb2d436 into main Mar 17, 2025
15 checks passed
@msyyc msyyc deleted the auto-microsoft-python-tcgc-0.51.3 branch March 17, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants