feat(wrapper-generator): follow @odata.nextLink with -All on every list cmdlet - #3743
feat(wrapper-generator): follow @odata.nextLink with -All on every list cmdlet #3743Joywambui-maina wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the generated Microsoft Graph PowerShell wrapper cmdlets to support consistent, pipeline-friendly pagination: list-shaped cmdlets can now follow @odata.nextLink when -All is provided, stream each page to the pipeline as it arrives, and emit a one-time warning when results are truncated due to missing -All. It also adjusts exception handling so PipelineStoppedException (e.g., Select-Object -First, Ctrl+C) is not caught and rethrown as a Graph failure.
Changes:
- Add
-Allto list cmdlets and implement a@odata.nextLinkloop (withWithUrl) that streams pages and re-applies headers on continuation requests. - Cap paging when
-Topis bound (at whole-page granularity) and warn once when a first response includes@odata.nextLinkbut-Allis not supplied. - Update cmdlet
try/catchblocks to excludePipelineStoppedExceptionfrom Graph error translation.
Reviewed changes
Copilot reviewed 300 out of 11723 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Users/wrapper/v1.0/Cmdlets/RemoveMgUserSettingStorage.g.cs | Updates exception handling to allow PipelineStoppedException to propagate rather than being translated into a Graph failure. |
| src/Identity.Partner/wrapper/v1.0/Cmdlets/GetMgTenantRelationshipDelegatedAdminCustomer_List.g.cs | Implements -All pagination via @odata.nextLink and emits a truncation warning when -All is not supplied. |
| src/Applications/wrapper/v1.0/Cmdlets/GetMgApplication_List.g.cs | Adds -All pagination and re-applies ConsistencyLevel + custom headers across continuation requests. |
| src/CloudCommunications/v1.0/custom/ListCmdlet.cs | Introduces/extends the shared runtime paging surface (including an All switch) used by generated list cmdlets. |
Suppressed comments (1)
src/Applications/wrapper/v1.0/Cmdlets/GetMgApplication_List.g.cs:60
- The ConsistencyLevel parameter HelpMessage appears to be copied from the If-Match/ETag description, which is misleading for users. Since this string is repeated across many generated list cmdlets, it should be corrected in the wrapper generator/template (and regenerated) to describe ConsistencyLevel usage (e.g., "eventual" for advanced queries such as $count/$search).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…st cmdlet List cmdlets silently returned only the first page. Every list-shaped cmdlet (1,479: 1,334 paired workers, 145 standalone) now takes -All, which follows each non-empty @odata.nextLink until the collection is exhausted, streaming every page to the pipeline before the next request is issued; the 1,334 public dispatchers declare the switch and forward it. A bound -Top caps the total under -All at whole-page granularity - the published ListCmdlet's shipped semantics, whose overflow trimmer has zero call sites in current generated output. 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 anyway. A pipeline stop now passes through both catch layers of every cmdlet instead of being re-branded a Graph failure - the change that touches all 11,719 generated files. Delta operations generate as functions, so they never reach the list template. Decisions and their evidence are recorded in tools/WrapperGenerator/docs/pagination.md. Proven: 189 generator tests including five pagination pins; tools/Test-WrapperPaging.ps1 drives the real compiled worker AND public dispatcher across a stubbed two-page collection (ten assertions, three rounds, all pass); -All walks a real Graph page boundary live - 182 items across two server pages, exact match to a calibrated total, three rounds - and the truncation warning fires exactly once at that boundary; operation inventory unchanged (11,719 = 11,719), parity identical (9,548 of 10,385), oracle 0 failures, package gate and live gate PASS.
bf2e605 to
bc7f1e6
Compare
Changes proposed:
Add -All to every list-shaped cmdlet (1,479) and its public dispatcher (1,334) — follows @odata.nextLink until the collection is exhausted, streaming each page to the pipeline before requesting the next
Cap the total with a bound -Top at whole-page granularity, matching the published SDK's shipped semantics
Warn once when a first response still carries a nextLink and -All wasn't supplied — no extra request; deliberately stronger than the published SDK, which truncates silently (this was approved in the design spec)
Continue through kiota's WithUrl, re-applying headers only, so ConsistencyLevel and -Headers survive page 2+
Let a pipeline stop (Select-Object -First N, Ctrl+C) pass through both catch layers instead of being re-branded a Graph failure — the change touching all 11,719 generated files
Record the decisions and their evidence in tools/WrapperGenerator/docs/pagination.md