diff --git a/bin/configs/powershell.yaml b/bin/configs/powershell.yaml
index 62a6dab02e14..c31d09aa13c3 100644
--- a/bin/configs/powershell.yaml
+++ b/bin/configs/powershell.yaml
@@ -10,3 +10,7 @@ additionalProperties:
powershellGalleryUrl: https://www.powershellgallery.com/packages/PSPetstore
apiNamePrefix: PS
powershellVersion: "5.0"
+ licenseUri: https://www.apache.org/licenses/LICENSE-2.0.txt
+ projectUri: https://github.com/OpenAPITools/openapi-generator
+ releaseNotes: 'This is a sample project'
+ tags: 'PetStore,powershell,sdk'
diff --git a/docs/generators/powershell.md b/docs/generators/powershell.md
index fc4a2d0f4432..a7040b189fc2 100644
--- a/docs/generators/powershell.md
+++ b/docs/generators/powershell.md
@@ -11,10 +11,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|
- **false**
- The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
- **true**
- when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.
|true|
|discardReadOnly|Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters| |null|
+|iconUri|A URL to an icon representing the generated PowerShell module| |null|
+|licenseUri|A URL to the license for the generated PowerShell module| |null|
|packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null|
|packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools|
|packageVersion|Package version (e.g. 0.1.2).| |0.1.2|
|powershellGalleryUrl|URL to the module in PowerShell Gallery (e.g. https://www.powershellgallery.com/packages/PSTwitter/).| |null|
+|projectUri|A URL to the main website for this project| |null|
+|releaseNotes|Release notes of the generated PowerShell module| |null|
+|tags|Tags applied to the generated PowerShell module. These help with module discovery in online galleries| |null|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |null|
## IMPORT MAPPING
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java
index fa012ed2d52a..379147ccb2af 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java
@@ -55,6 +55,11 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
protected HashSet methodNames; // store a list of method names to detect duplicates
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
protected boolean discardReadOnly = false; // Discard the readonly property in initialize cmdlet
+ protected String projectUri;
+ protected String licenseUri;
+ protected String releaseNotes;
+ protected String tags;
+ protected String iconUri;
/**
* Constructs an instance of `PowerShellClientCodegen`.
@@ -501,6 +506,11 @@ public PowerShellClientCodegen() {
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"));
+ cliOptions.add(new CliOption("tags","Tags applied to the generated PowerShell module. These help with module discovery in online galleries"));
+ cliOptions.add(new CliOption("projectUri","A URL to the main website for this project"));
+ cliOptions.add(new CliOption("licenseUri","A URL to the license for the generated PowerShell module"));
+ cliOptions.add(new CliOption("iconUri","A URL to an icon representing the generated PowerShell module"));
+ cliOptions.add(new CliOption("releaseNotes","Release notes of the generated PowerShell module"));
// option to change how we process + set the data in the 'additionalProperties' keyword.
CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean(
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT,
@@ -574,6 +584,27 @@ public boolean getDiscardReadOnly() {
return this.discardReadOnly;
}
+ public void setTags(String tags){
+ this.tags = tags;
+ }
+
+ public void setLicenseUri(String licenseUri){
+ this.licenseUri = licenseUri;
+ }
+
+ public void setProjectUri(String projectUri){
+ this.projectUri = projectUri;
+ }
+
+ public void setReleaseNotes(String releaseNotes){
+ this.releaseNotes = releaseNotes;
+ }
+
+ public void setIconUri(String iconUri){
+ this.iconUri = iconUri;
+ }
+
+
@Override
public void processOpts() {
this.setLegacyDiscriminatorBehavior(false);
@@ -600,6 +631,44 @@ public void processOpts() {
setDiscardReadOnly(convertPropertyToBooleanAndWriteBack("discardReadOnly"));
} else {
additionalProperties.put("discardReadOnly", discardReadOnly);
+ }
+
+ if (additionalProperties.containsKey("tags")) {
+ String[] entries = ((String) additionalProperties.get("tags")).split(",");
+ String prefix = "";
+ StringBuilder tagStr = new StringBuilder("@(");
+ for (String entry : entries) {
+ tagStr.append(prefix);
+ prefix = ",";
+ tagStr.append(String.format(Locale.ROOT, "'%s' ",entry));
+ }
+ tagStr.append(")");
+ setTags(tagStr.toString());
+ additionalProperties.put("tags",tagStr.toString());
+ }
+
+ if (additionalProperties.containsKey("releaseNotes")) {
+ setReleaseNotes((String) additionalProperties.get("releaseNotes"));
+ } else {
+ additionalProperties.put("releaseNotes", releaseNote);
+ }
+
+ if (additionalProperties.containsKey("licenseUri")) {
+ setLicenseUri((String) additionalProperties.get("licenseUri"));
+ } else {
+ additionalProperties.put("licenseUri", licenseUri);
+ }
+
+ if (additionalProperties.containsKey("projectUri")) {
+ setProjectUri((String) additionalProperties.get("projectUri"));
+ } else {
+ additionalProperties.put("projectUri", tags);
+ }
+
+ if (additionalProperties.containsKey("iconUri")) {
+ setIconUri((String) additionalProperties.get("iconUri"));
+ } else {
+ additionalProperties.put("iconUri", iconUri);
}
if (StringUtils.isNotBlank(powershellGalleryUrl)) {
diff --git a/modules/openapi-generator/src/main/resources/powershell/Build.ps1.mustache b/modules/openapi-generator/src/main/resources/powershell/Build.ps1.mustache
index 31fd8a32a838..794195948588 100644
--- a/modules/openapi-generator/src/main/resources/powershell/Build.ps1.mustache
+++ b/modules/openapi-generator/src/main/resources/powershell/Build.ps1.mustache
@@ -47,6 +47,21 @@ $Manifest = @{
Author = '{{{author}}}'
CompanyName = '{{{companyName}}}'
Description = '{{{packageName}}} - the PowerShell module for {{{appName}}}'
+ {{#tags}}
+ Tags = {{{.}}}
+ {{/tags}}
+ {{#projectUri}}
+ ProjectUri = '{{{.}}}'
+ {{/projectUri}}
+ {{#licenseUri}}
+ LicenseUri = '{{{.}}}'
+ {{/licenseUri}}
+ {{#iconUri}}
+ IconUri = '{{{.}}}'
+ {{/iconUri}}
+ {{#releaseNotes}}
+ ReleaseNotes = '{{{.}}}'
+ {{/releaseNotes}}
{{#psData}}
PrivateData = @{
diff --git a/samples/client/petstore/powershell/Build.ps1 b/samples/client/petstore/powershell/Build.ps1
index c6cc0b75d958..d892ed4513ea 100644
--- a/samples/client/petstore/powershell/Build.ps1
+++ b/samples/client/petstore/powershell/Build.ps1
@@ -53,6 +53,10 @@ $Manifest = @{
Author = 'OpenAPI Generator Team'
CompanyName = 'openapitools.org'
Description = 'PSPetstore - the PowerShell module for OpenAPI Petstore'
+ Tags = @('PetStore' ,'powershell' ,'sdk' )
+ ProjectUri = 'https://github.com/OpenAPITools/openapi-generator'
+ LicenseUri = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+ ReleaseNotes = 'This is a sample project'
ModuleVersion = '0.1.2'
diff --git a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1
index 4322e265be2b..6329693a91fe 100644
--- a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1
+++ b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1
@@ -3,7 +3,7 @@
#
# Generated by: OpenAPI Generator Team
#
-# Generated on: 6/4/20
+# Generated on: 30-11-2020
#
@{
@@ -33,7 +33,7 @@ Copyright = '(c) OpenAPI Generator Team. All rights reserved.'
Description = 'PSPetstore - the PowerShell module for OpenAPI Petstore'
# Minimum version of the PowerShell engine required by this module
-PowerShellVersion = '3.0'
+PowerShellVersion = '5.0'
# Name of the PowerShell host required by this module
# PowerShellHostName = ''
@@ -114,19 +114,19 @@ PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
- # Tags = @()
+ Tags = 'PetStore', 'powershell', 'sdk'
# A URL to the license for this module.
- # LicenseUri = ''
+ LicenseUri = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
# A URL to the main website for this project.
- # ProjectUri = ''
+ ProjectUri = 'https://github.com/OpenAPITools/openapi-generator'
# A URL to an icon representing this module.
# IconUri = ''
# ReleaseNotes of this module
- # ReleaseNotes = ''
+ ReleaseNotes = 'This is a sample project'
} # End of PSData hashtable