Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
use allVars to cover all properties
  • Loading branch information
wing328 committed Apr 5, 2020
commit 4e953d74d4525b09dc4fbaac85949cf9965e2a62
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
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));
}
}
Expand Down Expand Up @@ -952,7 +952,7 @@ private String constructExampleCode(CodegenModel codegenModel, HashMap<String, C

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, " ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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 {
Expand All @@ -38,9 +38,9 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {

$PSO = [PSCustomObject]@{
{{=<< >>=}}
<<#vars>>
<<#allVars>>
"<<baseName>>" = ${<<name>>}
<</vars>>
<</allVars>>
<<={{ }}=>>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down