Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[powershell] Fix fields null check in powershell model template #8323

Merged
merged 1 commit into from
Jan 5, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
{{#vars}}
{{^isNullable}}
{{#required}}
if (!${{{name}}}) {
if (${{{name}}} -eq $null) {
throw "invalid value for '{{{name}}}', '{{{name}}}' cannot be null."
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ function Initialize-PSPet {
'Creating PSCustomObject: PSPetstore => PSPet' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug

if (!$Name) {
if ($Name -eq $null) {
throw "invalid value for 'Name', 'Name' cannot be null."
}

if (!$PhotoUrls) {
if ($PhotoUrls -eq $null) {
throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null."
}

Expand Down