Skip to content

Adopt pageable spector scenarios #50260

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

Merged
merged 2 commits into from
May 27, 2025
Merged

Conversation

JoshLove-msft
Copy link
Member

Fixes #48061

@Copilot Copilot AI review requested due to automatic review settings May 24, 2025 19:06
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. CodeGen Issues that relate to code generation labels May 24, 2025
Copy link
Contributor

@Copilot 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 the generated pageable patterns to support Spector’s next-link and continuation-token scenarios by passing explicit nextLink URIs, unifying loop logic, and propagating cancellation tokens to the base Pageable constructors.

  • Constructors now call the base Pageable ctor with the cancellation token.
  • Paging methods switch from string-based continuation tokens to Uri next-link variables and reshape loops accordingly.
  • The code generator (CollectionResultDefinition) was refactored to better handle protocol vs. model-based paging, plus adjustments to launch settings and script exclusions.

Reviewed Changes

Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/Providers/.../NextLinkTests/*.cs Updated test stubs to use Uri nextLink and new loop patterns
test/Providers/.../ListPageableTests/*.cs Converted single-page loops to direct calls, removed do/while
test/Providers/.../ContinuationTokenTests/*.cs Switched to nextPage tokens, removed old continuationToken logic
src/Providers/CollectionResultDefinition.cs Refactored generator to insert nextLink, nullability, and loop building
src/Properties/launchSettings.json Added http-payload-pageable profile
eng/scripts/Generate.ps1 Removed failing payload/pageable spec from generation script
Comments suppressed due to low confidence (1)

eng/packages/http-client-csharp/generator/Azure.Generator/src/Providers/CollectionResultDefinition.cs:45

  • The continuationToken parameter should remain nullable to reflect that callers may pass null. Use new CSharpType(typeof(string), isNullable: true) so the generated signature is string? continuationToken.
private static readonly ParameterProvider ContinuationTokenParameter = new("continuationToken", "A continuation token indicating where to resume paging.", new CSharpType(typeof(string)));

@Azure Azure deleted a comment from josh-love1 May 26, 2025
@JoshLove-msft JoshLove-msft enabled auto-merge (squash) May 26, 2025 17:19
@JoshLove-msft JoshLove-msft merged commit 484f1ef into Azure:main May 27, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. CodeGen Issues that relate to code generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adopt payload/pageable scenario from Spector
2 participants