Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Conversation

@bmanikm
Copy link
Contributor

@bmanikm bmanikm commented Oct 6, 2017

  • 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.
…Noun_VerbBySomething - 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.
if(-not $cmdNoun) {
$cmdNoun = Get-PascalCasedString -Name $cmdNounSuffix
}
elseif(-not $cmdNounSuffix.StartsWith('By', [System.StringComparison]::OrdinalIgnoreCase)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

-not $cmdNounSuffix.StartsWith('By', [System.StringComparison]::OrdinalIgnoreCase) [](start = 23, length = 82)

Quick note for anyone looking at this change - this is temporary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR resolves the feedback received from Azure PS team.
In future, if we come up with more heuristics, the entire functionality of the this Get-PathCommandName can be changed.

@bmanikm bmanikm merged commit 749c391 into PowerShell:developer Oct 6, 2017
@bmanikm bmanikm deleted the OperationIdsWithBySomething branch October 6, 2017 21:36
bmanikm added a commit that referenced this pull request Oct 9, 2017
* 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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants