Skip to content

Commit d893ee8

Browse files
authored
use allVars to cover all properties (#5835)
1 parent e9c1346 commit d893ee8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
818818
Map<String, Object> mo = (Map<String, Object>) _mo;
819819
CodegenModel cm = (CodegenModel) mo.get("model");
820820

821-
for (CodegenProperty cp : cm.vars) {
821+
for (CodegenProperty cp : cm.allVars) {
822822
cp.vendorExtensions.put("x-powershell-data-type", getPSDataType(cp));
823823
}
824824
}
@@ -952,7 +952,7 @@ private String constructExampleCode(CodegenModel codegenModel, HashMap<String, C
952952

953953
example = "(Initialize-" + codegenModel.name;
954954
List<String> propertyExamples = new ArrayList<>();
955-
for (CodegenProperty codegenProperty : codegenModel.vars) {
955+
for (CodegenProperty codegenProperty : codegenModel.allVars) {
956956
propertyExamples.add("-" + codegenProperty.name + " " + constructExampleCode(codegenProperty, modelMaps, processedModelMap));
957957
}
958958
example += StringUtils.join(propertyExamples, " ");

modules/openapi-generator/src/main/resources/powershell-experimental/model.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}}
1212

13-
{{#vars}}
13+
{{#allVars}}
1414
.PARAMETER {{{name}}}
1515
{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}}
1616

17-
{{/vars}}
17+
{{/allVars}}
1818
.OUTPUTS
1919

2020
{{{classname}}}<PSCustomObject>
@@ -23,13 +23,13 @@
2323
function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
2424
[CmdletBinding()]
2525
Param (
26-
{{#vars}}
26+
{{#allVars}}
2727
[Parameter(Position = {{vendorExtensions.x-index}}, ValueFromPipelineByPropertyName = $true{{#required}}, Mandatory = $true{{/required}})]
2828
[{{vendorExtensions.x-powershell-data-type}}]
2929
{{=<% %>=}}
3030
${<%name%>}<%^-last%>,<%/-last%>
3131
<%={{ }}=%>
32-
{{/vars}}
32+
{{/allVars}}
3333
)
3434

3535
Process {
@@ -38,9 +38,9 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
3838
3939
$PSO = [PSCustomObject]@{
4040
{{=<< >>=}}
41-
<<#vars>>
41+
<<#allVars>>
4242
"<<baseName>>" = ${<<name>>}
43-
<</vars>>
43+
<</allVars>>
4444
<<={{ }}=>>
4545
}
4646

samples/client/petstore/powershell-experimental/src/PSPetstore/Client/PSConfiguration.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Get the host setting in the form of array of hashtables.
291291
System.Collections.Hashtable[]
292292
#>
293293
function Get-PSHostSetting {
294-
return @(
294+
return ,@(
295295
@{
296296
"Url" = "http://{server}.swagger.io:{port}/v2";
297297
"Description" = "petstore server";

0 commit comments

Comments
 (0)