forked from loafle/openapi-generator-original
[PS][PowerShell] fix passthru, use switch instead of bool (#5768)
* fix passthru, use switch * remove line
This commit is contained in:
parent
7e22b4b8cf
commit
3316f17ed5
@ -89,6 +89,9 @@ Skip certificate verification
|
|||||||
.PARAMETER DefaultHeaders
|
.PARAMETER DefaultHeaders
|
||||||
Default HTTP headers to be included in the HTTP request
|
Default HTTP headers to be included in the HTTP request
|
||||||
|
|
||||||
|
.PARAMETER PassThru
|
||||||
|
Return an object of the Configuration
|
||||||
|
|
||||||
.OUTPUTS
|
.OUTPUTS
|
||||||
|
|
||||||
System.Collections.Hashtable
|
System.Collections.Hashtable
|
||||||
@ -108,10 +111,9 @@ function Set-{{{apiNamePrefix}}}Configuration {
|
|||||||
[string]$Cookie,
|
[string]$Cookie,
|
||||||
[AllowEmptyString()]
|
[AllowEmptyString()]
|
||||||
[string]$AccessToken,
|
[string]$AccessToken,
|
||||||
[switch]$PassThru,
|
[switch]$SkipCertificateCheck,
|
||||||
[bool]$SkipCertificateCheck,
|
|
||||||
[hashtable]$DefaultHeaders,
|
[hashtable]$DefaultHeaders,
|
||||||
[switch]$Force
|
[switch]$PassThru
|
||||||
)
|
)
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
@ -144,13 +146,19 @@ function Set-{{{apiNamePrefix}}}Configuration {
|
|||||||
$Script:Configuration['AccessToken'] = $AccessToken
|
$Script:Configuration['AccessToken'] = $AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($SkipCertificateCheck) {
|
If ($SkipCertificateCheck.IsPresent) {
|
||||||
$Script:Configuration['SkipCertificateCheck'] = $SkipCertificateCheck
|
$Script:Configuration['SkipCertificateCheck'] = $true
|
||||||
}
|
} else {
|
||||||
|
$Script:Configuration['SkipCertificateCheck'] = $false
|
||||||
|
}
|
||||||
|
|
||||||
If ($DefaultHeaders) {
|
If ($DefaultHeaders) {
|
||||||
$Script:Configuration['DefaultHeaders'] = $DefaultHeaders
|
$Script:Configuration['DefaultHeaders'] = $DefaultHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
If ($PassThru.IsPresent) {
|
||||||
|
$Script:Configuration
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,9 @@ Skip certificate verification
|
|||||||
.PARAMETER DefaultHeaders
|
.PARAMETER DefaultHeaders
|
||||||
Default HTTP headers to be included in the HTTP request
|
Default HTTP headers to be included in the HTTP request
|
||||||
|
|
||||||
|
.PARAMETER PassThru
|
||||||
|
Return an object of the Configuration
|
||||||
|
|
||||||
.OUTPUTS
|
.OUTPUTS
|
||||||
|
|
||||||
System.Collections.Hashtable
|
System.Collections.Hashtable
|
||||||
@ -114,10 +117,9 @@ function Set-PSConfiguration {
|
|||||||
[string]$Cookie,
|
[string]$Cookie,
|
||||||
[AllowEmptyString()]
|
[AllowEmptyString()]
|
||||||
[string]$AccessToken,
|
[string]$AccessToken,
|
||||||
[switch]$PassThru,
|
[switch]$SkipCertificateCheck,
|
||||||
[bool]$SkipCertificateCheck,
|
|
||||||
[hashtable]$DefaultHeaders,
|
[hashtable]$DefaultHeaders,
|
||||||
[switch]$Force
|
[switch]$PassThru
|
||||||
)
|
)
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
@ -150,13 +152,19 @@ function Set-PSConfiguration {
|
|||||||
$Script:Configuration['AccessToken'] = $AccessToken
|
$Script:Configuration['AccessToken'] = $AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($SkipCertificateCheck) {
|
If ($SkipCertificateCheck.IsPresent) {
|
||||||
$Script:Configuration['SkipCertificateCheck'] = $SkipCertificateCheck
|
$Script:Configuration['SkipCertificateCheck'] = $true
|
||||||
}
|
} else {
|
||||||
|
$Script:Configuration['SkipCertificateCheck'] = $false
|
||||||
|
}
|
||||||
|
|
||||||
If ($DefaultHeaders) {
|
If ($DefaultHeaders) {
|
||||||
$Script:Configuration['DefaultHeaders'] = $DefaultHeaders
|
$Script:Configuration['DefaultHeaders'] = $DefaultHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
If ($PassThru.IsPresent) {
|
||||||
|
$Script:Configuration
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Generated by: OpenAPI Generator Team
|
# Generated by: OpenAPI Generator Team
|
||||||
#
|
#
|
||||||
# Generated on: 3/30/20
|
# Generated on: 3/31/20
|
||||||
#
|
#
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
@ -94,5 +94,12 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' {
|
|||||||
$Configuration["DefaultHeaders"]["TestKey"] | Should Be "TestValue"
|
$Configuration["DefaultHeaders"]["TestKey"] | Should Be "TestValue"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It "Configuration tests" {
|
||||||
|
$Conf = Get-PSConfiguration
|
||||||
|
$Conf["SkipCertificateCheck"] | Should Be $false
|
||||||
|
$Conf = Set-PSConfiguration -PassThru -SkipCertificateCheck
|
||||||
|
$Conf["SkipCertificateCheck"] | Should Be $true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user