support enum in parameters (#5838)

This commit is contained in:
William Cheng 2020-04-06 14:45:45 +08:00 committed by GitHub
parent d893ee883b
commit f1325e23ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,11 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
Param ( Param (
{{#allParams}} {{#allParams}}
[Parameter(Position = {{vendorExtensions.x-index}}{{#-first}}, ValueFromPipeline = $true{{/-first}}, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [Parameter(Position = {{vendorExtensions.x-index}}{{#-first}}, ValueFromPipeline = $true{{/-first}}, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
{{#isEnum}}
{{#allowableValues}}
[ValidateSet({{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}})]
{{/allowableValues}}
{{/isEnum}}
[{{{vendorExtensions.x-powershell-data-type}}}] [{{{vendorExtensions.x-powershell-data-type}}}]
{{=<% %>=}} {{=<% %>=}}
${<%paramName%>}, ${<%paramName%>},

View File

@ -187,6 +187,7 @@ function Find-PSPetsByStatus {
[CmdletBinding()] [CmdletBinding()]
Param ( Param (
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
[ValidateSet("available", "pending", "sold")]
[String[]] [String[]]
${Status}, ${Status},
[Switch] [Switch]

View File

@ -3,7 +3,7 @@
# #
# Generated by: OpenAPI Generator Team # Generated by: OpenAPI Generator Team
# #
# Generated on: 4/4/20 # Generated on: 4/6/20
# #
@{ @{