Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions PSSwagger/PSSwagger.Constants.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,19 @@ $PagingBlockStrFunctionCallWithTop = @'

Write-Verbose -Message 'Flattening paged results.'
# Get the next page iff 1) there is a next page and 2) any result in the next page would be returned
while (`$result -and `$result.NextPageLink -and ((`$Top -eq -1) -or (`$returnedCount -lt `$Top))) {
Write-Debug -Message "Retrieving next page: `$(`$result.NextPageLink)"
`$taskResult = $clientName$pagingOperations.$pagingOperationName(`$result.NextPageLink)
while (`$result -and (Get-Member -InputObject `$result -Name $NextLinkName) -and `$result.$NextLinkName -and ((`$Top -eq -1) -or (`$returnedCount -lt `$Top))) {
Write-Debug -Message "Retrieving next page: `$(`$result.$NextLinkName)"
`$taskResult = $clientName$pagingOperations.$pagingOperationName(`$result.$NextLinkName)
$getTaskResult
}
'@

$PagingBlockStrFunctionCall = @'

Write-Verbose -Message 'Flattening paged results.'
while (`$result -and `$result.NextPageLink) {
Write-Debug -Message "Retrieving next page: `$(`$result.NextPageLink)"
`$taskResult = $clientName$pagingOperations.$pagingOperationName(`$result.NextPageLink)
while (`$result -and (Get-Member -InputObject `$result -Name $NextLinkName) -and `$result.$NextLinkName) {
Write-Debug -Message "Retrieving next page: `$(`$result.$NextLinkName)"
`$taskResult = $clientName$pagingOperations.$pagingOperationName(`$result.$NextLinkName)
$getTaskResult
}
'@
Expand All @@ -393,17 +393,17 @@ $PagingBlockStrCmdletCallWithTop = @'

Write-Verbose -Message 'Flattening paged results.'
# Get the next page iff 1) there is a next page and 2) any result in the next page would be returned
while (`$result -and `$result.NextPageLink -and ((`$Top -eq -1) -or (`$returnedCount -lt `$Top))) {
Write-Debug -Message "Retrieving next page: `$(`$result.NextPageLink)"
while (`$result -and (Get-Member -InputObject `$result -Name $NextLinkName) -and `$result.$NextLinkName -and ((`$Top -eq -1) -or (`$returnedCount -lt `$Top))) {
Write-Debug -Message "Retrieving next page: `$(`$result.$NextLinkName)"
$Cmdlet $CmdletArgs
}
'@

$PagingBlockStrCmdletCall = @'

Write-Verbose -Message 'Flattening paged results.'
while (`$result -and `$result.NextPageLink) {
Write-Debug -Message "Retrieving next page: `$(`$result.NextPageLink)"
while (`$result -and (Get-Member -InputObject `$result -Name $NextLinkName) -and `$result.$NextLinkName) {
Write-Debug -Message "Retrieving next page: `$(`$result.$NextLinkName)"
$Cmdlet $CmdletArgs
}
'@
Expand Down
5 changes: 5 additions & 0 deletions PSSwagger/Paths.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ function New-SwaggerPath
$skipParameterToAdd = $null
$pagingBlock = ''
$pagingOperationName = ''
$NextLinkName = 'NextLink'
$pagingOperations = ''
$Cmdlet = ''
$CmdletParameter = ''
Expand All @@ -558,6 +559,10 @@ function New-SwaggerPath
$CmdletArgs = $x_ms_pageableObject.CmdletArgsPaging
}

if ($x_ms_pageableObject.ContainsKey('NextLinkName') -and $x_ms_pageableObject.NextLinkName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NextLinkName [](start = 46, length = 12)

Add test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have any tests for x-ms-pageable. I will create a tracking issue for that. To unblock Jeffrey, I would like to merge this fix now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened #295.

$NextLinkName = $x_ms_pageableObject.NextLinkName
}

$topParameterToAdd = @{
Details = @{
Name = 'Top'
Expand Down
7 changes: 0 additions & 7 deletions Tests/run-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,6 @@ if ($TestSuite.Contains("All")) {
$executeTestsCommand += " -Tag $TestSuite"
}



# Clean up generated test assemblies
Write-Verbose "Cleaning old test assemblies, if any."
Get-ChildItem -Path (Join-Path "$PSScriptRoot" "PSSwagger.TestUtilities") -Filter *.dll | Remove-Item -Force
Get-ChildItem -Path (Join-Path "$PSScriptRoot" "PSSwagger.TestUtilities") -Filter *.pdb | Remove-Item -Force

Write-Verbose "Dependency versions:"
Write-Verbose " -- AzureRM.Profile: $($azureRmProfile.Version)"
Write-Verbose " -- Pester: $((get-command invoke-pester).Version)"
Expand Down