Skip to content

Commit

Permalink
Use loop instead of recursion for pagination. (#1225)
Browse files Browse the repository at this point in the history
* Use loop instead of recursion for pagination.

* Update submodule.

* Skip IMGR tests
  • Loading branch information
peombwa authored May 3, 2022
1 parent c78189a commit 89c0daf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion autorest.powershell
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Describe 'Invoke-MgGraphRequest Command' {
Describe 'Invoke-MgGraphRequest Command' -skip {
BeforeAll {
$utils = Join-Path $PSScriptRoot "../../../../tools/Utilities/utils.ps1" -Resolve
. $utils
Expand Down
6 changes: 3 additions & 3 deletions src/readme.graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ directive:
{
return $;
} else {
let odataNextLinkRegex = /(^\s*)(if\s*\(\s*result.OdataNextLink\s*!=\s*null\s*\))/gmi
let odataNextLinkRegex = /(^\s*)(while\s*\(\s*_nextLink\s*!=\s*null\s*\))/gmi
if($.match(odataNextLinkRegex)) {
// Add custom -PageSize parameter to *_List cmdlets that support Odata next link.
$ = $.replace(odataNextLinkRegex, '$1if (result.OdataNextLink != null && this.ShouldIteratePages(this.InvocationInformation.BoundParameters, result.Value.Length))\n$1');
$ = $.replace(odataNextLinkRegex, '$1while (_nextLink != null && this.ShouldIteratePages(this.InvocationInformation.BoundParameters, result.Value.Length))\n$1');
let psBaseClassImplementationRegex = /(\s*:\s*)(global::System.Management.Automation.PSCmdlet)/gmi
$ = $.replace(psBaseClassImplementationRegex, '$1Microsoft.Graph.PowerShell.Cmdlets.Custom.ListCmdlet');
Expand All @@ -592,7 +592,7 @@ directive:
let countPlaceholder = (!$.includes("SwitchParameter _count;")) ? 'global::System.Management.Automation.SwitchParameter _count;': ''
$ = $.replace(beginProcessingRegex, `$1$2\n$1 ${countPlaceholder} ${topPlaceholder} if (this.InvocationInformation?.BoundParameters != null){ InitializeCmdlet(ref this.__invocationInfo, ref _top, ref _count); }\n$1`);
let odataNextLinkCallRegex = /(^\s*)(await\s*this\.Client\.UsersUserListUser_Call\(requestMessage\,\s*onOk\,\s*onDefault\,\s*this\,\s*Pipeline\)\;)/gmi
let odataNextLinkCallRegex = /(^\s*)(await\s*this\.Client\..*_Call\(requestMessage\,\s*onOk\,\s*onDefault\,\s*this\,\s*Pipeline\)\;)/gmi
$ = $.replace(odataNextLinkCallRegex, '$1requestMessage.RequestUri = GetOverflowItemsNextLinkUri(requestMessage.RequestUri);\n$1$2');
// Set -Count parameter to private. This will be replaced by -CountVariable
Expand Down

0 comments on commit 89c0daf

Please sign in to comment.