Skip to content

feat(wrapper-generator): emit -All and nextLink following for list cmdlets - #3746

Open
Joywambui-maina wants to merge 1 commit into
feat/wrapper-packagingfrom
feat/wrapper-pagination-generator
Open

feat(wrapper-generator): emit -All and nextLink following for list cmdlets#3746
Joywambui-maina wants to merge 1 commit into
feat/wrapper-packagingfrom
feat/wrapper-pagination-generator

Conversation

@Joywambui-maina

Copy link
Copy Markdown

Changes proposed:

-Emit an -All switch on every list-shaped cmdlet that follows each non-empty @odata.nextLink to exhaustion, streaming each page to the pipeline before the next request goes out
-Declare the switch on the public dispatcher too, so it reaches the worker — the binder rejects an undeclared parameter before forwarding ever happens
-Cap the total with a bound -Top at whole-page granularity, matching the published ListCmdlet's shipped semantics
-Warn once when a first response still carries a nextLink and -All wasn't supplied — no extra request. This is deliberately stronger than the published SDK, which truncates silently; approved in the design spec
-Continue through kiota's WithUrl, re-applying headers only, so ConsistencyLevel and caller -Headers survive page 2 onward while the link carries its own query state
-Let a pipeline stop (Select-Object -First N, Ctrl+C) pass through the shared catch instead of being re-branded a Graph failure
Record the decisions and their evidence in tools/WrapperGenerator/docs/pagination.md

…dlets

List cmdlets emitted only the first page and dropped @odata.nextLink, so
scripts silently received partial data. EmitListGet - the single template
behind every list-shaped cmdlet - now emits an -All switch that follows each
non-empty nextLink to exhaustion, streaming every page to the pipeline before
the next request is issued, and the public dispatcher declares the switch so
it reaches the worker. A bound -Top caps the total under -All at whole-page
granularity, matching the published ListCmdlet's shipped semantics. Without
-All a surviving nextLink writes one short warning and costs no extra request
- deliberately stronger than the published SDK, which truncates silently;
approved in the design spec. Continuations go through kiota's WithUrl and
re-apply headers only: the link already carries the query state, and a
raw-URL builder ignores query bindings. A pipeline stop passes through the
shared catch instead of being re-branded a Graph failure. Decisions and
evidence in tools/WrapperGenerator/docs/pagination.md. Proven: 189 generator
tests including five pagination pins, and tools/Test-WrapperPaging.ps1 drives
a real compiled cmdlet and public dispatcher across a stubbed two-page
collection - ten assertions, three rounds, all pass.

The regenerated corpus follows in a separate pull request.
// re-applies headers only; query bindings here would be dead code.
result = client.{{naming.BuilderExpression}}.WithUrl(nextLink).GetAsync(requestConfiguration =>
{{{continuationHeaders}}
}).GetAwaiter().GetResult();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No cancellation token forwarded to GetAsync. The !Stopping check only fires between pages. A long-running single-page fetch (large page, slow network) won't respond to Ctrl+C until it completes. The doc acknowledges this as a known limitation, but consider whether threading this.StoppingToken (if available in the base class) through to GetAsync is feasible.

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.

2 participants