Model/GetAttributes400Response.ps1
|
# # NERM API # The NERM API accesss and modifies resources in your environment. # Version: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION No description available. .PARAMETER Json JSON object .OUTPUTS GetAttributes400Response<PSCustomObject> #> function ConvertFrom-NERMJsonToGetAttributes400Response { [CmdletBinding()] Param ( [AllowEmptyString()] [string]$Json ) Process { $match = 0 $matchType = $null $matchInstance = $null # try to match InvalidJson defined in the oneOf schemas try { $matchInstance = ConvertFrom-NERMJsonToInvalidJson $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "InvalidJson" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'InvalidJson' defined in oneOf (NERMGetAttributes400Response). Proceeding to the next one if any." } # try to match ValidationErrors defined in the oneOf schemas try { $matchInstance = ConvertFrom-NERMJsonToValidationErrors $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "ValidationErrors" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'ValidationErrors' defined in oneOf (NERMGetAttributes400Response). Proceeding to the next one if any." } if ($match -gt 1) { throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([InvalidJson, ValidationErrors]). JSON Payload: $($Json)" } elseif ($match -eq 1) { return [PSCustomObject]@{ "ActualType" = ${matchType} "ActualInstance" = ${matchInstance} "OneOfSchemas" = @("InvalidJson", "ValidationErrors") } } else { throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([InvalidJson, ValidationErrors]). JSON Payload: $($Json)" } } } |