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

Commit e9bd9fa

Browse files
committed
readme update (#292)
* readme update * Review comments * review
1 parent 37c44eb commit e9bd9fa

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

README.md

+38-34
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ A PowerShell module with commands to generate the PowerShell commands for a give
2323
## Supported Platforms
2424
| Usage | Platforms |
2525
| ----------------| ------------------------------------- |
26-
| Developer | Windows, Any full PowerShell version, PowerShell Core (NOTE: AzureRM.Profile is currently broken on beta.1, but a new module should be released soon) |
27-
| Module Publisher| Any full PowerShell version |
28-
| Module Consumer | Any full PowerShell version, PowerShell Core Alpha11 or older |
26+
| Developer | Windows, PowerShell 5.1+, Latest PowerShell Core |
27+
| Module Publisher| PowerShell 5.1+ |
28+
| Module Consumer | PowerShell 5.1+, Latest PowerShell Core |
2929

30+
**Future note**: We plan on supporting PowerShell 4+ for module consumers in the future; that scenario is untested currently.
3031
**Testing note**: While any full PowerShell version is fine for development, we recommend using PowerShell 5.1+ to enable testing our implementation of Get-FileHash.
3132

3233
## Dependencies
@@ -40,11 +41,16 @@ A PowerShell module with commands to generate the PowerShell commands for a give
4041
| AzureRM.Profile.NetCore.Preview | * | Module containing authentication helpers, required for Microsoft Azure modules on PowerShell Core |
4142

4243
## Usage
43-
44-
1. Git clone this repository.
45-
```code
46-
git clone https://github.com/PowerShell/PSSwagger.git
47-
```
44+
NOTE: In the short term, for best performance, the operation IDs in your Open API specifications should be of the form "<Noun>_<Verb><Suffix>". For example, the operation ID "Resource_GetByName" gets a resource named Resource by name.
45+
1. Get PSSwagger!
46+
* Install from PowerShellGallery.com:
47+
```powershell
48+
Install-Module -Name PSSwagger
49+
```
50+
* Clone the repository
51+
```powershell
52+
git clone https://github.com/PowerShell/PSSwagger.git
53+
```
4854
4955
2. Ensure you AutoRest version 0.17.3 installed
5056
```powershell
@@ -53,40 +59,38 @@ A PowerShell module with commands to generate the PowerShell commands for a give
5359

5460
3. Ensure AutoRest.exe is in $env:Path
5561
```powershell
56-
$env:path += ";$env:localappdata\PackageManagement\NuGet\Packages\AutoRest.0.17.3\tools"
62+
$package = Get-Package -Name AutoRest -RequiredVersion 0.17.3
63+
$env:path += ";$(Split-Path $package.Source -Parent)\tools"
5764
```
5865

5966
4. If you plan on precompiling the generated assembly, ensure you have the module AzureRM.Profile or AzureRM.NetCore.Preview available to PackageManagement if you are on PowerShell or PowerShell Core, respectively.
6067

6168
5. Run the following in a PowerShell console from the directory where you cloned PSSwagger in
62-
```powershell
63-
Import-Module .\PSSwagger\PSSwagger.psd1
64-
$param = @{
65-
SpecificationUri = 'https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-batch/2015-12-01/swagger/BatchManagement.json'
66-
Path = 'C:\GeneratedModules\'
67-
Name = 'AzBatchManagement'
68-
UseAzureCsharpGenerator = $true
69-
}
70-
New-PSSwaggerModule @param
71-
```
7269

73-
After step 5, the module will be in `C:\Temp\GeneratedModule\Generated.AzureRM.BatchManagement ($param.Path)` folder.
74-
75-
Before importing that module and using it, you need to import `PSSwaggerUtility` module which is under PSSwagger folder.
76-
77-
```powershell
78-
Import-Module .\PSSwagger\PSSwaggerUtility
79-
Import-Module "$($param.Path)\$($param.Name)"
80-
Get-Command -Module $param.Name
81-
```
70+
```powershell
71+
Import-Module .\PSSwagger\PSSwagger.psd1
72+
$param = @{
73+
# Download the Open API v2 Specification from this location
74+
SpecificationUri = 'https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-batch/2015-12-01/swagger/BatchManagement.json'
75+
# Output the generated module to this path
76+
Path = 'C:\GeneratedModules\'
77+
# Name of the generated module
78+
Name = 'AzBatchManagement'
79+
# This specification is for a Microsoft Azure service, so use Azure-specific functionality
80+
UseAzureCsharpGenerator = $true
81+
}
82+
# You may be prompted to download missing dependencies
83+
New-PSSwaggerModule @param
84+
```
85+
The generated module will be in the `C:\Temp\GeneratedModule\Generated.AzureRM.BatchManagement` folder.
86+
For more New-PSSwaggerModule options, check out the [documentation](/docs/commands/New-PSSwaggerModule.md).
87+
6. Your generated module is now ready! For production modules (i.e. modules you will publish to PowerShellGallery.com), we recommend using the -IncludeCoreFxAssembly option to generate the Core CLR assembly, strong name signing assemblies in the generated module, and authenticode signing the module. Optionally, you can remove the generated C# code (under the Generated.CSharp folder) for even more security.
88+
89+
## Metadata Generation
90+
There are many cases where module generation doesn't result in the most optimal names for things like parameters or commands. To enable this and many other customization options, we've introduced additional PowerShell-specific Open API extensions that can be specified separately from your main specification. For more information, check out [PowerShell Extensions](/docs/extensions/readme.md) and [New-PSSwaggerMetadataFile](/docs/commands/New-PSSwaggerMetadataFile.md).
8291
8392
## Dynamic generation of C# assembly
84-
When importing the module for the first time, the packaged C# files will be automatically compiled if the expected assembly doesn't exist.
85-
If the module's script files are signed, regardless of your script execution policy, the catalog file's signing will be checked for validity.
86-
If the generated module is not signed, the catalog file's signing will not be checked. However, the catalog file's hashed contents will always be checked.
87-
88-
## Distribution of module
89-
Because of the dynamic compilation feature, it is highly recommended that publishers of a generated module Authenticode sign the module and strong name sign both precompiled assemblies (full CLR and core CLR).
93+
When importing the module for the first time, the packaged C# files will be automatically compiled if the expected assembly doesn't exist.
9094
9195
## Microsoft.Rest.ServiceClientTracing support
9296
To enable Microsoft.Rest.ServiceClientTracing support, pass -Debug into any generated command.

0 commit comments

Comments
 (0)