[PowerShell] add more fields to be customized (#6835)

* more fields to be customized

* set powershell version

* fix psData
This commit is contained in:
William Cheng
2020-07-02 23:50:50 +08:00
committed by GitHub
parent 23f57a7290
commit aed5be9b9c
5 changed files with 20 additions and 5 deletions

View File

@@ -9,3 +9,4 @@ additionalProperties:
packageName: PSPetstore
powershellGalleryUrl: https://www.powershellgallery.com/packages/PSPetstore
apiNamePrefix: PS
powershellVersion: "5.0"

View File

@@ -501,6 +501,12 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.add(new CliOption("commonVerbs", "PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly."));
cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC));
cliOptions.add(new CliOption("discardReadOnly", "Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters"));
// default value in the template
additionalProperties.put("powershellVersion", "6.2"); // minimal PS version
additionalProperties.put("author", "OpenAPI Generator Team");
additionalProperties.put("companyName", "openapitools.org");
additionalProperties.put("psData", null);
}
public CodegenType getTag() {

View File

@@ -44,16 +44,24 @@ $FunctionPath = 'Api', 'Model', 'Client' | ForEach-Object {Join-Path "$ScriptDir
$Manifest = @{
Path = "$ScriptDir\src\{{{packageName}}}\{{{packageName}}}.psd1"
Author = 'OpenAPI Generator Team'
CompanyName = 'openapitools.org'
Author = '{{{author}}}'
CompanyName = '{{{companyName}}}'
Description = '{{{packageName}}} - the PowerShell module for {{{appName}}}'
{{#psData}}
PrivateData = @{
PSData = @{
{{{.}}}
}
}
{{/psData}}
ModuleVersion = '{{{packageVersion}}}'
RootModule = '{{{packageName}}}.psm1'
Guid = '{{packageGuid}}' # Has to be static, otherwise each new build will be considered different module
PowerShellVersion = '3.0'
PowerShellVersion = '{{{powershellVersion}}}'
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport

View File

@@ -18,7 +18,7 @@ This PowerShell module is automatically generated by the [OpenAPI Generator](htt
<a name="frameworks-supported"></a>
## Frameworks supported
- PowerShell 5.0 or later
- PowerShell {{{powershellVersion}}} or later
<a name="dependencies"></a>
## Dependencies

View File

@@ -59,7 +59,7 @@ $Manifest = @{
RootModule = 'PSPetstore.psm1'
Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module
PowerShellVersion = '3.0'
PowerShellVersion = '5.0'
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport