forked from loafle/openapi-generator-original
Fix error message templates for some field names (#8321)
some fields may start with a "u" character which causes Powershell to think it is a unicode escape sequence.
This commit is contained in:
@@ -246,12 +246,12 @@ function ConvertFrom-{{{apiNamePrefix}}}JsonTo{{{classname}}} {
|
||||
{{#requiredVars}}
|
||||
{{#-first}}
|
||||
If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
|
||||
throw "Error! Empty JSON cannot be serialized due to the required property `{{{baseName}}}` missing."
|
||||
throw "Error! Empty JSON cannot be serialized due to the required property '{{{baseName}}}' missing."
|
||||
}
|
||||
|
||||
{{/-first}}
|
||||
if (!([bool]($JsonParameters.PSobject.Properties.name -match "{{{baseName}}}"))) {
|
||||
throw "Error! JSON cannot be serialized due to the required property `{{{baseName}}}` missing."
|
||||
throw "Error! JSON cannot be serialized due to the required property '{{{baseName}}}' missing."
|
||||
} else {
|
||||
${{name}} = $JsonParameters.PSobject.Properties["{{{baseName}}}"].value
|
||||
}
|
||||
|
||||
@@ -120,17 +120,17 @@ function ConvertFrom-PSJsonToPet {
|
||||
}
|
||||
|
||||
If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
|
||||
throw "Error! Empty JSON cannot be serialized due to the required property `name` missing."
|
||||
throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing."
|
||||
}
|
||||
|
||||
if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) {
|
||||
throw "Error! JSON cannot be serialized due to the required property `name` missing."
|
||||
throw "Error! JSON cannot be serialized due to the required property 'name' missing."
|
||||
} else {
|
||||
$Name = $JsonParameters.PSobject.Properties["name"].value
|
||||
}
|
||||
|
||||
if (!([bool]($JsonParameters.PSobject.Properties.name -match "photoUrls"))) {
|
||||
throw "Error! JSON cannot be serialized due to the required property `photoUrls` missing."
|
||||
throw "Error! JSON cannot be serialized due to the required property 'photoUrls' missing."
|
||||
} else {
|
||||
$PhotoUrls = $JsonParameters.PSobject.Properties["photoUrls"].value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user