forked from loafle/openapi-generator-original
better null comparison (#10915)
This commit is contained in:
parent
37a4429024
commit
c244c23053
@ -144,7 +144,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
|
||||
|
||||
{{/hasHttpSignatureMethods}}
|
||||
if ($SkipCertificateCheck -eq $true) {
|
||||
if ($Configuration["Proxy"] -eq $null) {
|
||||
if ($null -eq $Configuration["Proxy"]) {
|
||||
# skip certification check, no proxy
|
||||
$Response = Invoke-WebRequest -Uri $UriBuilder.Uri `
|
||||
-Method $Method `
|
||||
@ -166,7 +166,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient {
|
||||
-ProxyUseDefaultCredentials
|
||||
}
|
||||
} else {
|
||||
if ($Configuration["Proxy"] -eq $null) {
|
||||
if ($null -eq $Configuration["Proxy"]) {
|
||||
# perform certification check, no proxy
|
||||
$Response = Invoke-WebRequest -Uri $UriBuilder.Uri `
|
||||
-Method $Method `
|
||||
@ -241,7 +241,7 @@ function DeserializeResponse {
|
||||
[string[]]$ContentTypes
|
||||
)
|
||||
|
||||
If ($ContentTypes -eq $null) {
|
||||
If ($null -eq $ContentTypes) {
|
||||
$ContentTypes = [string[]]@()
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ test_script:
|
||||
}
|
||||
deploy_script:
|
||||
- pwsh: |
|
||||
if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null) {
|
||||
if ($env:APPVEYOR_REPO_TAG -eq $true -and $null -ne $env:NuGetApiKey) {
|
||||
.\Build.ps1
|
||||
try {
|
||||
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\{{{packageName}}}\ -Confirm:$False -Verbose
|
||||
|
@ -172,7 +172,7 @@ function Set-{{{apiNamePrefix}}}Configuration {
|
||||
$Script:Configuration['DefaultHeaders'] = $DefaultHeaders
|
||||
}
|
||||
|
||||
If ($Proxy -ne $null) {
|
||||
If ($null -ne $Proxy) {
|
||||
If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") {
|
||||
throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque."
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
|
||||
{{#vars}}
|
||||
{{^isNullable}}
|
||||
{{#required}}
|
||||
if (${{{name}}} -eq $null) {
|
||||
if ($null -eq ${{{name}}}) {
|
||||
throw "invalid value for '{{{name}}}', '{{{name}}}' cannot be null."
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ test_script:
|
||||
}
|
||||
deploy_script:
|
||||
- pwsh: |
|
||||
if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null) {
|
||||
if ($env:APPVEYOR_REPO_TAG -eq $true -and $null -ne $env:NuGetApiKey) {
|
||||
.\Build.ps1
|
||||
try {
|
||||
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\PSPetstore\ -Confirm:$False -Verbose
|
||||
|
@ -178,7 +178,7 @@ function Set-PSConfiguration {
|
||||
$Script:Configuration['DefaultHeaders'] = $DefaultHeaders
|
||||
}
|
||||
|
||||
If ($Proxy -ne $null) {
|
||||
If ($null -ne $Proxy) {
|
||||
If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") {
|
||||
throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque."
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ function Initialize-PSPet {
|
||||
'Creating PSCustomObject: PSPetstore => PSPet' | Write-Debug
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
if ($Name -eq $null) {
|
||||
if ($null -eq $Name) {
|
||||
throw "invalid value for 'Name', 'Name' cannot be null."
|
||||
}
|
||||
|
||||
if ($PhotoUrls -eq $null) {
|
||||
if ($null -eq $PhotoUrls) {
|
||||
throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null."
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ function Invoke-PSApiClient {
|
||||
}
|
||||
|
||||
if ($SkipCertificateCheck -eq $true) {
|
||||
if ($Configuration["Proxy"] -eq $null) {
|
||||
if ($null -eq $Configuration["Proxy"]) {
|
||||
# skip certification check, no proxy
|
||||
$Response = Invoke-WebRequest -Uri $UriBuilder.Uri `
|
||||
-Method $Method `
|
||||
@ -153,7 +153,7 @@ function Invoke-PSApiClient {
|
||||
-ProxyUseDefaultCredentials
|
||||
}
|
||||
} else {
|
||||
if ($Configuration["Proxy"] -eq $null) {
|
||||
if ($null -eq $Configuration["Proxy"]) {
|
||||
# perform certification check, no proxy
|
||||
$Response = Invoke-WebRequest -Uri $UriBuilder.Uri `
|
||||
-Method $Method `
|
||||
@ -228,7 +228,7 @@ function DeserializeResponse {
|
||||
[string[]]$ContentTypes
|
||||
)
|
||||
|
||||
If ($ContentTypes -eq $null) {
|
||||
If ($null -eq $ContentTypes) {
|
||||
$ContentTypes = [string[]]@()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user