Add support for string response deserialization (#12910)

* Add support for string response deserialization

* updated samples

* updated samples

* realigned to master

* fix: errors were not getting thrown

* updated samples

* fix: errors were not getting thrown

* updated samples
This commit is contained in:
Emanuele Saccomandi
2022-07-21 06:45:50 +02:00
committed by GitHub
parent cf58ac0583
commit b8524bee23
123 changed files with 76 additions and 10025 deletions

View File

@@ -1,97 +0,0 @@
#
# OpenAPI Petstore
# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
<#
.SYNOPSIS
No summary available.
.DESCRIPTION
No description available.
.PARAMETER Breed
No description available.
.OUTPUTS
DogAllOf<PSCustomObject>
#>
function Initialize-PSDogAllOf {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
[String]
${Breed}
)
Process {
'Creating PSCustomObject: PSPetstore => PSDogAllOf' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{
"breed" = ${Breed}
}
return $PSO
}
}
<#
.SYNOPSIS
Convert from JSON to DogAllOf<PSCustomObject>
.DESCRIPTION
Convert from JSON to DogAllOf<PSCustomObject>
.PARAMETER Json
Json object
.OUTPUTS
DogAllOf<PSCustomObject>
#>
function ConvertFrom-PSJsonToDogAllOf {
Param(
[AllowEmptyString()]
[string]$Json
)
Process {
'Converting JSON to PSCustomObject: PSPetstore => PSDogAllOf' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$JsonParameters = ConvertFrom-Json -InputObject $Json
# check if Json contains properties not defined in PSDogAllOf
$AllProperties = ("breed")
foreach ($name in $JsonParameters.PsObject.Properties.Name) {
if (!($AllProperties.Contains($name))) {
throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
}
}
if (!([bool]($JsonParameters.PSobject.Properties.name -match "breed"))) { #optional property not found
$Breed = $null
} else {
$Breed = $JsonParameters.PSobject.Properties["breed"].value
}
$PSO = [PSCustomObject]@{
"breed" = ${Breed}
}
return $PSO
}
}