use allVars to cover all properties (#5835)

This commit is contained in:
William Cheng
2020-04-06 10:54:49 +08:00
committed by GitHub
parent e9c1346386
commit d893ee883b
3 changed files with 9 additions and 9 deletions

View File

@@ -818,7 +818,7 @@ public class PowerShellExperimentalClientCodegen extends DefaultCodegen implemen
Map<String, Object> mo = (Map<String, Object>) _mo;
CodegenModel cm = (CodegenModel) mo.get("model");
for (CodegenProperty cp : cm.vars) {
for (CodegenProperty cp : cm.allVars) {
cp.vendorExtensions.put("x-powershell-data-type", getPSDataType(cp));
}
}
@@ -952,7 +952,7 @@ public class PowerShellExperimentalClientCodegen extends DefaultCodegen implemen
example = "(Initialize-" + codegenModel.name;
List<String> propertyExamples = new ArrayList<>();
for (CodegenProperty codegenProperty : codegenModel.vars) {
for (CodegenProperty codegenProperty : codegenModel.allVars) {
propertyExamples.add("-" + codegenProperty.name + " " + constructExampleCode(codegenProperty, modelMaps, processedModelMap));
}
example += StringUtils.join(propertyExamples, " ");

View File

@@ -10,11 +10,11 @@
{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}}
{{#vars}}
{{#allVars}}
.PARAMETER {{{name}}}
{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}}
{{/vars}}
{{/allVars}}
.OUTPUTS
{{{classname}}}<PSCustomObject>
@@ -23,13 +23,13 @@
function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
[CmdletBinding()]
Param (
{{#vars}}
{{#allVars}}
[Parameter(Position = {{vendorExtensions.x-index}}, ValueFromPipelineByPropertyName = $true{{#required}}, Mandatory = $true{{/required}})]
[{{vendorExtensions.x-powershell-data-type}}]
{{=<% %>=}}
${<%name%>}<%^-last%>,<%/-last%>
<%={{ }}=%>
{{/vars}}
{{/allVars}}
)
Process {
@@ -38,9 +38,9 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
$PSO = [PSCustomObject]@{
{{=<< >>=}}
<<#vars>>
<<#allVars>>
"<<baseName>>" = ${<<name>>}
<</vars>>
<</allVars>>
<<={{ }}=>>
}

View File

@@ -291,7 +291,7 @@ Get the host setting in the form of array of hashtables.
System.Collections.Hashtable[]
#>
function Get-PSHostSetting {
return @(
return ,@(
@{
"Url" = "http://{server}.swagger.io:{port}/v2";
"Description" = "petstore server";