-   Notifications  
You must be signed in to change notification settings  - Fork 28
 
Write exceptions in generated commands #324
Write exceptions in generated commands #324
Conversation
|   Having merge issues, stay tuned :D #Closed  |  
   PSSwagger/PSSwagger.Constants.ps1  Outdated    
 | Get-ChildItem -Path (Join-Path -Path "`$PSScriptRoot" -ChildPath "ref" | Join-Path -ChildPath "`$clr" | Join-Path -ChildPath "*.dll") -File | ForEach-Object { Add-Type -Path `$_.FullName -ErrorAction SilentlyContinue } | ||
| if (Test-Path -Path (Join-Path -Path "`$PSScriptRoot" -ChildPath "ref" | Join-Path -ChildPath "`$clr")) | ||
| { | ||
| Get-ChildItem -Path (Join-Path -Path "`$PSScriptRoot" -ChildPath "ref" | Join-Path -ChildPath "`$clr" | Join-Path -ChildPath "*.dll") -File | ForEach-Object { Add-Type -Path `$_.FullName -ErrorAction SilentlyContinue } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Join-Path -Path "
$PSScriptRoot" -ChildPath "ref" | Join-Path -ChildPath "$clr" [](start = 25, length = 80)
Consider reusing the above constructed clr path here. #Closed
   PSSwagger/PSSwagger.psm1  Outdated    
 | $dependencies = Get-PSSwaggerExternalDependencies -Azure:$codeCreatedByAzureGenerator -Framework 'net4' | ||
| $microsoftRestClientRuntimeAzureRequiredVersion = if ($dependencies.ContainsKey('Microsoft.Rest.ClientRuntime.Azure')) { $dependencies['Microsoft.Rest.ClientRuntime.Azure'].RequiredVersion } else { '' } | ||
| $command = "PSSwaggerUtility\Add-PSSwaggerClientType -OutputAssemblyName '$outAssembly' `` | ||
| $command = "`$env:PSModulePath = '$env:PSModulePath'; PSSwaggerUtility\Add-PSSwaggerClientType -OutputAssemblyName '$outAssembly' `` | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$env:PSModulePath = '$env:PSModulePath'; [](start = 20, length = 41)
Is this a workaround for running tests on PSCore? #Closed
   Tests/PSSwaggerScenario.Tests.ps1  Outdated    
 | Import-Module $PsSwaggerPath -Force | ||
| if((Get-Variable -Name PSEdition -ErrorAction Ignore) -and ('Core' -eq $PSEdition)) { | ||
| & "powershell.exe" -command "& {`$env:PSModulePath=`$env:PSModulePath_Backup; | ||
| & "$global:fullPowerShellPath\powershell.exe" -command "& {`$env:Path = '$global:fullPowerShellPath;$env:Path';`$env:PSModulePath=`$env:PSModulePath_Backup; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$global:fullPowerShellPath\powershell.exe [](start = 19, length = 41)
Consider using "$env:SystemRoot\System32\WindowsPowerShell\v1.0\PowerShell.exe". #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use this path, I would like to reduce the dependency on run-tests.ps1 and use Invoke-Pester directly on PSCore for this file.
 If not, I would like to know the reasons/thoughts.
In reply to: 137919841 [](ancestors = 137919841)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
| if((Get-Variable -Name PSEdition -ErrorAction Ignore) -and ('Core' -eq $PSEdition)) { | ||
| & "powershell.exe" -command "& {`$env:PSModulePath=`$env:PSModulePath_Backup; | ||
| & "$global:fullPowerShellPath\powershell.exe" -command "& {`$env:Path = '$global:fullPowerShellPath;$env:Path';`$env:PSModulePath=`$env:PSModulePath_Backup; | ||
| Import-Module (Join-Path `"$PsSwaggerPath`" `"PSSwagger.psd1`") -Force; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import-Module (Join-Path
"$PsSwaggerPath""PSSwagger.psd1") -Force; [](start = 12, length = 71)
Please add this line along with powershell.exe with full path in the new utility function I have added in my last PR. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on it - see #324 (comment) #Closed
   PSSwagger/PSSwagger.Constants.ps1  Outdated    
 | $DynamicAssemblyGenerationCode | ||
| `$allDllsPath = Join-Path -Path `$ClrPath -ChildPath '*.dll' | ||
| Get-ChildItem -Path `$allDllsPath -File | ForEach-Object { Add-Type -Path `$_.FullName -ErrorAction SilentlyContinue } | ||
| if (Test-Path -Path `$ClrPath) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add -PathType Container #Closed
   PSSwagger/PSSwagger.psm1  Outdated    
 | CodeCreatedByAzureGenerator = `$$codeCreatedByAzureGenerator | ||
| BootstrapConsent = `$$UserConsent | ||
| } | ||
| `$env:PSModulePath += '$env:PSModulePath' | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$env:PSModulePath += '$env:PSModulePath' [](start = 12, length = 41)
Will this work when the current value of PSModulePath doesn't end with ';' ? #Closed
   PSSwagger/PSSwagger.psm1  Outdated    
 | CodeCreatedByAzureGenerator = `$$codeCreatedByAzureGenerator | ||
| BootstrapConsent = `$$UserConsent | ||
| } | ||
| `$env:PSModulePath += '$env:PSModulePath' | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$env:PSModulePath += '$env:PSModulePath' [](start = 12, length = 41)
Will this work as expected in all cases? like when PSCore is installed with PSSwaggerUtility module? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current PSModulePath contains PSCore modules. The only problem here will be that core tests probably use PSSwaggerUtility in the user/global PSCore module path instead of the dev path. However, using the PSCore module paths is preferred over the PS module paths in general. We can figure out how to get around this if we run into a problem. #Closed
   Tests/PSSwaggerScenario.Tests.ps1  Outdated    
 | $Header = '__Custom_HEADER_Content__' | ||
| if((Get-Variable -Name PSEdition -ErrorAction Ignore) -and ('Core' -eq $PSEdition)) { | ||
| & "powershell.exe" -command "& {`$env:PSModulePath=`$env:PSModulePath_Backup; | ||
| & "$global:fullPowerShellPath\powershell.exe" -command "& {`$env:Path = '$global:fullPowerShellPath;$env:Path';`$env:PSModulePath=`$env:PSModulePath_Backup; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$env:Path = '$global:fullPowerShellPath;$env:Path' [](start = 72, length = 50)
May I know the reason for this? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With recent builds of PSCore, running "powershell" in PSCore results in more PSCore. #Closed
   Tests/PSSwaggerScenario.Tests.ps1  Outdated    
 | $Header = '__Custom_HEADER_Content__' | ||
| if((Get-Variable -Name PSEdition -ErrorAction Ignore) -and ('Core' -eq $PSEdition)) { | ||
| & "powershell.exe" -command "& {`$env:PSModulePath=`$env:PSModulePath_Backup; | ||
| & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\PowerShell.exe" -command "& {`$env:Path = '$env:SystemRoot\System32\WindowsPowerShell\v1.0\PowerShell.exe;$env:Path';`$env:PSModulePath=`$env:PSModulePath_Backup; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$env:Path = '$env:SystemRoot\System32\WindowsPowerShell\v1.0\PowerShell.exe;$env:Path' [](start = 92, length = 87)
Is below line expected and required?
 `$env:Path = '$env:SystemRoot\System32\WindowsPowerShell\v1.0\PowerShell.exe;$env:Path' #Closed
| } | ||
| } | ||
| } | ||
| $result | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this.
 I was unable to validate for PSCore during my PR.
|   Thanks for making the required changes to run tests for PSCore.  |  
1372f94 to c958ca5   Compare   * Increment PSSwagger version * readme update (#292) * readme update * Review comments * review * Support custom x-ms-pageable\NextLinkName field name (#294) * Updated Readme and fixed an error related to importing the PSSwaggerUtility module. (#300) * Fix localization error in SwaggerUtil (#303) Pluralization is only supported for the English language. * Ensure $oDataQuery expression is generated properly when a global parameter is referenced in more than one swagger operations with or without x-ms-odata extension. (#307) * Alpha 1 of test server (#309) * Alpha 1 of test server * Support default and customizable header comment for the PSSwagger generated files (#310) * Support default and customizable header comment for the PSSwagger generated files. Added Header parameter on New-PSSwaggerModule cmdlet to prepend the customized header content in the PSSwagger generated files. - It also can be a path to a .txt file with the content to be added as header in the PSSwagger generated files. - Specify 'NONE' to suppress the default header. - Below is the default header content ` Code generated by Microsoft (R) PSSwagger <version> Changes may cause incorrect behavior and will be lost if the code is regenerated. ` - Also enabled support for header content from x-ms-code-generation-settings extension in swagger spec. - To customize the header for AutoRest generated files, use AutoRest specific info.x-ms-code-generation-settings.header in the swagger spec. * Add support for generating the C# SDK assembly using CSC.exe on Windows PS. (#312) Latest version of AutoRest generates C# 6 code. Add-Type on Windows PS doesn't support compilation of C# 6 code. Made required changes to leverage the CSC.exe for generating the C# SDK assembly on Windows PowerShell. Additional changes - Updated readme and run-tests.ps1 - Removed stale source code files under PSSwagger.Azure.Helpers folder. - Removed `Import-Module '$PSScriptRoot\PSSwaggerUtility'` usage for PowerShellCore. * Support latest version of AutoRest in PSSwagger (#313) * Support latest version of AutoRest in PSSwagger - Added required parameter changes to support AutoRest.cmd. - Removed dependency on AutoRest.CSharp.dll. - Added required logic in Get-CSharpModelName function to escape C# reserved words and also to remove special characters as per AutoRest functionality. - Updated run-tests.ps1 to install and use NodeJS and other minor changes. - Updated Readme with updated instructions and other info. * Using NodeJS '7.10.0' as there are some perf issues in AutoRest with NodeJS '8.4.0'. * Removing the langversion from CSC parameters as latest is the default language version. (#318) Reason: '/langversion:latest' is not supported on all versions of CSC.exe, especially the version installed with Visual Studio. * Changes for test server to work for Azure SDK happy path tests (#315) * Parameterless execution of PSSwagger.LTF.ConsoleServer.exe + test module fixes * Fix parse of config.json * Load config.json from .exe directory + composite logger + event log logger * ASCII -> UTF8 * Headers should always be passed as arrays * Bunch of fixes to get happy path working in Azure tests * Argument validation * Add support for predefined header values. (#320) Supported predefined license header values are - NONE: Suppresses the default header. - MICROSOFT_MIT: Adds predefined Microsoft MIT license text with default PSSwagger code generation header content. - MICROSOFT_MIT_NO_VERSION: Adds predefined Microsoft MIT license text with default PSSwagger code generation header content without version. - MICROSOFT_MIT_NO_CODEGEN: Adds predefined Microsoft MIT license text without default PSSwagger code generation header content. - MICROSOFT_APACHE: Adds predefined Microsoft Apache license text with default PSSwagger code generation header content. - MICROSOFT_APACHE_NO_VERSION: Adds predefined Microsoft Apache license text with default PSSwagger code generation header content without version. - MICROSOFT_APACHE_NO_CODEGEN: Adds predefined Microsoft Apache license text without default PSSwagger code generation header content. Resolves #317. * Add support for generating PowerShell cmdlets using pre-built SDK assembly and specification. (#321) * Add support for generating PowerShell cmdlets using pre-compiled SDK assembly and Swagger specification. * Added -ModelsName parameter on New-PSSwaggerModule cmdlet, and also enabled the tests to run on PSCore. * Add New-ServiceClient utility function in generated module to enable mock testing (#325) * Add Get-ServiceClient utility function in generated module to enable mock testing. Resolves #298 * Added documentation * Updated New-ServiceClient uility to set ServiceCredentials, SubscriptionId, BaseUri, HttpClientHandler and global parameter properties on the service client object. * Write exceptions in generated commands (#324) * Write exceptions in generated commands, some fixes for core CLR test pass * Update taskresult handling logic to give priority to the $taskResult.Result.Body. (#326) Couple of other minor fixes found while generating modules for the Azure Swagger specs. Resolves #319. * Handle unwrapping exceptions to CloudError objects, update (#327) Newtonsoft.Json because of bug, add emptied HttpResponseMessage to error response * Fix for server spinning bug (#330) * Change warninglevel to 1 for generating assembly for Azure Swagger specs. (#331) ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\monitor\autoscale_API.json'. PSSwaggerUtility\Add-PSSwaggerClientType : C:\temp\AzureSwaggerSpecs\AzModules\symbols\Azmonitor\0.0.1\Generated.Microsoft.PowerShell.Azmonitor.v001.cs(433,23): warning CS0108: 'ActivityLogAlertLeafCondition.Equals' hides inherited member 'object. the new keyword if hiding was intended. At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:900 char:14 + ... if(-not (PSSwaggerUtility\Add-PSSwaggerClientType @AddPSSwaggerCli ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Add-PSSwaggerClientType ConvertTo-CsharpCode : Unable to generate 'Microsoft.PowerShell.Azmonitor.v001.dll' assembly At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:545 char:37 + ... lyGenerationResult = ConvertTo-CsharpCode @ConvertToCsharpCode_params + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToGenerateAssembly,ConvertTo-CsharpCode ``` Minor additional changes - Fixed the issue for setting $env:PSModulePath to compile coreclr binary - Added verb mapping for 'Verify' --> 'Test'. * Resolve UnableToExtractDetailsFromSdkAssembly error when OperationType in OperationId conflicts with Definition name. (#332) When OperationType value conflicts with a definition name, AutoREST generates method name by adding Method to the OperationType. Current error for swagger specs of Azure Servicebus and Relay services. ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\servicebus\servicebus.json'. Update-PathFunctionDetails : Module generation failed. If no error messages follow, check the output of code metadata extraction above Unable to find expected method 'CheckNameAvailabilityWithHttpMessagesAsync' on type 'Microsoft.PowerShell.Azservicebus.v001.INamespacesOperations' At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:555 char:28 + ... onDetails = Update-PathFunctionDetails -PathFunctionDetails $PathFunc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToExtractDetailsFromSdkAssembly,Update-PathFunctionDetails ``` ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\relay\relay.json'. Update-PathFunctionDetails : Module generation failed. If no error messages follow, check the output of code metadata extraction above Unable to find expected method 'CheckNameAvailabilityWithHttpMessagesAsync' on type 'Microsoft.PowerShell.Azrelay.v001.INamespacesOperations' At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:555 char:28 + ... onDetails = Update-PathFunctionDetails -PathFunctionDetails $PathFunc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToExtractDetailsFromSdkAssembly,Update-PathFunctionDetails ``` * Rename IsOSX to IsMacOS after breaking change in PowerShell 6.0.0-beta.7 to fix #333 (#334) * Generate SYNOPSIS help content in the generated cmdlets. (#337) * Add support for AdditionalProperties Json schema with array type (#339) * Added support for AdditionalProperties Json schema with array type. ```json "type": "string", "additionalProperties": { "type": "array", "items": { "type": "string" } } ``` Current error ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\network\applicationGateway.json'. WARNING: 'ParameterJsonObject' has unsupported properties. type additionalProperties description ---- -------------------- ----------- string @{type=array; items=; description=List of IP Addresses within the tag (key)} Mapping of tags to list of IP Addresses included within the tag. ``` * Added support for $ParameterJsonObject.AdditionalProperties.Items.'$ref' * Add support for parameter type references to enum definitions. (#341) Resolves #115. * Add AutoRest version in run-tests.ps1 (#344) * Added AutoRest version in run-tests.ps1 * Add support for generating proper output type for the Swagger operations with x-ms-pageable extension (#342) * Added support for generating proper output type for the Swaagger operations with x-ms-pageable extension. * Add CHANGELOG.md, and minor update for releasing the 0.3.0 version of PSSwagger and PSSwaggerUtility modules. (#345)
* Increment PSSwagger version * readme update (#292) * readme update * Review comments * review * Support custom x-ms-pageable\NextLinkName field name (#294) * Updated Readme and fixed an error related to importing the PSSwaggerUtility module. (#300) * Fix localization error in SwaggerUtil (#303) Pluralization is only supported for the English language. * Ensure $oDataQuery expression is generated properly when a global parameter is referenced in more than one swagger operations with or without x-ms-odata extension. (#307) * Alpha 1 of test server (#309) * Alpha 1 of test server * Support default and customizable header comment for the PSSwagger generated files (#310) * Support default and customizable header comment for the PSSwagger generated files. Added Header parameter on New-PSSwaggerModule cmdlet to prepend the customized header content in the PSSwagger generated files. - It also can be a path to a .txt file with the content to be added as header in the PSSwagger generated files. - Specify 'NONE' to suppress the default header. - Below is the default header content ` Code generated by Microsoft (R) PSSwagger <version> Changes may cause incorrect behavior and will be lost if the code is regenerated. ` - Also enabled support for header content from x-ms-code-generation-settings extension in swagger spec. - To customize the header for AutoRest generated files, use AutoRest specific info.x-ms-code-generation-settings.header in the swagger spec. * Add support for generating the C# SDK assembly using CSC.exe on Windows PS. (#312) Latest version of AutoRest generates C# 6 code. Add-Type on Windows PS doesn't support compilation of C# 6 code. Made required changes to leverage the CSC.exe for generating the C# SDK assembly on Windows PowerShell. Additional changes - Updated readme and run-tests.ps1 - Removed stale source code files under PSSwagger.Azure.Helpers folder. - Removed `Import-Module '$PSScriptRoot\PSSwaggerUtility'` usage for PowerShellCore. * Support latest version of AutoRest in PSSwagger (#313) * Support latest version of AutoRest in PSSwagger - Added required parameter changes to support AutoRest.cmd. - Removed dependency on AutoRest.CSharp.dll. - Added required logic in Get-CSharpModelName function to escape C# reserved words and also to remove special characters as per AutoRest functionality. - Updated run-tests.ps1 to install and use NodeJS and other minor changes. - Updated Readme with updated instructions and other info. * Using NodeJS '7.10.0' as there are some perf issues in AutoRest with NodeJS '8.4.0'. * Removing the langversion from CSC parameters as latest is the default language version. (#318) Reason: '/langversion:latest' is not supported on all versions of CSC.exe, especially the version installed with Visual Studio. * Changes for test server to work for Azure SDK happy path tests (#315) * Parameterless execution of PSSwagger.LTF.ConsoleServer.exe + test module fixes * Fix parse of config.json * Load config.json from .exe directory + composite logger + event log logger * ASCII -> UTF8 * Headers should always be passed as arrays * Bunch of fixes to get happy path working in Azure tests * Argument validation * Add support for predefined header values. (#320) Supported predefined license header values are - NONE: Suppresses the default header. - MICROSOFT_MIT: Adds predefined Microsoft MIT license text with default PSSwagger code generation header content. - MICROSOFT_MIT_NO_VERSION: Adds predefined Microsoft MIT license text with default PSSwagger code generation header content without version. - MICROSOFT_MIT_NO_CODEGEN: Adds predefined Microsoft MIT license text without default PSSwagger code generation header content. - MICROSOFT_APACHE: Adds predefined Microsoft Apache license text with default PSSwagger code generation header content. - MICROSOFT_APACHE_NO_VERSION: Adds predefined Microsoft Apache license text with default PSSwagger code generation header content without version. - MICROSOFT_APACHE_NO_CODEGEN: Adds predefined Microsoft Apache license text without default PSSwagger code generation header content. Resolves #317. * Add support for generating PowerShell cmdlets using pre-built SDK assembly and specification. (#321) * Add support for generating PowerShell cmdlets using pre-compiled SDK assembly and Swagger specification. * Added -ModelsName parameter on New-PSSwaggerModule cmdlet, and also enabled the tests to run on PSCore. * Add New-ServiceClient utility function in generated module to enable mock testing (#325) * Add Get-ServiceClient utility function in generated module to enable mock testing. Resolves #298 * Added documentation * Updated New-ServiceClient uility to set ServiceCredentials, SubscriptionId, BaseUri, HttpClientHandler and global parameter properties on the service client object. * Write exceptions in generated commands (#324) * Write exceptions in generated commands, some fixes for core CLR test pass * Update taskresult handling logic to give priority to the $taskResult.Result.Body. (#326) Couple of other minor fixes found while generating modules for the Azure Swagger specs. Resolves #319. * Handle unwrapping exceptions to CloudError objects, update (#327) Newtonsoft.Json because of bug, add emptied HttpResponseMessage to error response * Fix for server spinning bug (#330) * Change warninglevel to 1 for generating assembly for Azure Swagger specs. (#331) ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\monitor\autoscale_API.json'. PSSwaggerUtility\Add-PSSwaggerClientType : C:\temp\AzureSwaggerSpecs\AzModules\symbols\Azmonitor\0.0.1\Generated.Microsoft.PowerShell.Azmonitor.v001.cs(433,23): warning CS0108: 'ActivityLogAlertLeafCondition.Equals' hides inherited member 'object. the new keyword if hiding was intended. At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:900 char:14 + ... if(-not (PSSwaggerUtility\Add-PSSwaggerClientType @AddPSSwaggerCli ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Add-PSSwaggerClientType ConvertTo-CsharpCode : Unable to generate 'Microsoft.PowerShell.Azmonitor.v001.dll' assembly At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:545 char:37 + ... lyGenerationResult = ConvertTo-CsharpCode @ConvertToCsharpCode_params + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToGenerateAssembly,ConvertTo-CsharpCode ``` Minor additional changes - Fixed the issue for setting $env:PSModulePath to compile coreclr binary - Added verb mapping for 'Verify' --> 'Test'. * Resolve UnableToExtractDetailsFromSdkAssembly error when OperationType in OperationId conflicts with Definition name. (#332) When OperationType value conflicts with a definition name, AutoREST generates method name by adding Method to the OperationType. Current error for swagger specs of Azure Servicebus and Relay services. ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\servicebus\servicebus.json'. Update-PathFunctionDetails : Module generation failed. If no error messages follow, check the output of code metadata extraction above Unable to find expected method 'CheckNameAvailabilityWithHttpMessagesAsync' on type 'Microsoft.PowerShell.Azservicebus.v001.INamespacesOperations' At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:555 char:28 + ... onDetails = Update-PathFunctionDetails -PathFunctionDetails $PathFunc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToExtractDetailsFromSdkAssembly,Update-PathFunctionDetails ``` ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\relay\relay.json'. Update-PathFunctionDetails : Module generation failed. If no error messages follow, check the output of code metadata extraction above Unable to find expected method 'CheckNameAvailabilityWithHttpMessagesAsync' on type 'Microsoft.PowerShell.Azrelay.v001.INamespacesOperations' At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:555 char:28 + ... onDetails = Update-PathFunctionDetails -PathFunctionDetails $PathFunc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToExtractDetailsFromSdkAssembly,Update-PathFunctionDetails ``` * Rename IsOSX to IsMacOS after breaking change in PowerShell 6.0.0-beta.7 to fix #333 (#334) * Generate SYNOPSIS help content in the generated cmdlets. (#337) * Add support for AdditionalProperties Json schema with array type (#339) * Added support for AdditionalProperties Json schema with array type. ```json "type": "string", "additionalProperties": { "type": "array", "items": { "type": "string" } } ``` Current error ```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\network\applicationGateway.json'. WARNING: 'ParameterJsonObject' has unsupported properties. type additionalProperties description ---- -------------------- ----------- string @{type=array; items=; description=List of IP Addresses within the tag (key)} Mapping of tags to list of IP Addresses included within the tag. ``` * Added support for $ParameterJsonObject.AdditionalProperties.Items.'$ref' * Add support for parameter type references to enum definitions. (#341) Resolves #115. * Add AutoRest version in run-tests.ps1 (#344) * Added AutoRest version in run-tests.ps1 * Add support for generating proper output type for the Swagger operations with x-ms-pageable extension (#342) * Added support for generating proper output type for the Swaagger operations with x-ms-pageable extension. * Add CHANGELOG.md, and minor update for releasing the 0.3.0 version of PSSwagger and PSSwaggerUtility modules. (#345) * New-ServiceClient error on custom host (#350) * [Azure and AzureStack] Use IClientFactory to create ARM Client in Azure PowerShell way. (#348) This takes care of both Azure and AzureStack services including setting the proper values for SubscriptionId and BaseUri, etc., This also ensure that the generated cmdlets remain compatible over changes to the Profile cmdlets and Azure authentication. Additional minor update - Removed 'MIT license' fixed header from the generated module helper script files. * Verb map change: 'Regenerate' to 'New' instead of 'Update' as per the feedback recieved from Azure PowerShell team. (#347) * Use separate PSCmdletOutputItemType variable for getting the output item type of pageable swagger operations. (#351) Reason: $pageType is used in expanding the result script blocks for $skip and $top. * Escape '<#' and '#>', and replace '--' with '==' in Header content (#352) Resolves #349. * Updated to escape block comment character sequence, if any, using the PowerShell escape character, grave-accent(`). * Changes to replace -- with == and warning message. * Add all non-complex type properties in output format ps1xml files. (#354) Also added TableColumnHeader with width. * Add NoVersionFolder switch parameter on New-PSSwaggerModule cmdlet to not create the version folder. (#355) Resolves #353 * Add few verb mappings for Azure RPs (#356) * Move New-HttpClientHandler logic into New-ServiceClient for non-Azure services. (#357) Currently, GeneratedHelpers.ps1 get copied to the generated module folder of Azure modules. This unification ensures that non-Azure services can replace the functionality in New-ServiceClient.ps1 and also helps in mock testing. Going forward, if we add any new helper utility function it will go into a separate .ps1 file, that's why GeneratedHelpers.ps1 file got removed in this PR. * Generate single Verb-Noun cmdlet for OperationIds like Noun_Verb and Noun_VerbBySomething (#358) - Added support for generating the single Verb-Noun cmdlet with multuple parameter sets for OperationIds like Noun_Verb and Noun_VerbBySomething. - Updated the parameterset prioritazation logic to retrieve the default parameter set with minimum number of mandatory parameters. * Update change log to include new changes into 0.3.0 release. (#359) - Removed the date next to the version as it requires additional commit when we need to release the newer versions at different date than the one mentioned in the changelog.md. * Revert the changes from automatic merge commit from master to developer branch. (#361)
Write exceptions in generated commands + some fixes for core CLR test pass.