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 9, 2017

No description provided.

brywang-msft and others added 30 commits August 8, 2017 11:34
* readme update

* Review comments

* review
Pluralization is only supported for the English language.
…ameter is referenced in more than one swagger operations with or without x-ms-odata extension. (#307)
* Alpha 1 of test server
…erated 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.
…ws 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
- 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'.
… language version. (#318)

Reason: '/langversion:latest' is not supported on all versions of CSC.exe, especially the version installed with Visual Studio.
* 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
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.
…embly 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.
…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, some fixes for core CLR test
pass
…Result.Body. (#326)

Couple of other minor fixes found while generating modules for the Azure Swagger specs.
Resolves #319.
Newtonsoft.Json because of bug, add emptied HttpResponseMessage to error
response
…ecs. (#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'.
…e 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
```
* 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'
* Added AutoRest version in run-tests.ps1
…ons with x-ms-pageable extension (#342)

* Added support for generating proper output type for the Swaagger operations with x-ms-pageable extension.
bmanikm added 12 commits October 3, 2017 11:36
…re 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.
… feedback recieved from Azure PowerShell team. (#347)
…tem type of pageable swagger operations. (#351)

Reason: $pageType is used in expanding the result script blocks for $skip and $top.
)

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.
… not create the version folder. (#355)

Resolves #353
… 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.
…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.
- 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.
@bmanikm bmanikm requested a review from brywang-msft October 9, 2017 22:02
@bmanikm bmanikm merged commit 89b98bb into master Oct 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants