forked from loafle/openapi-generator-original
[Inline model resolver] better handling of inline responses and bug fixes (#12353)
* better handling of inline response schemas, bug fixes * update samples * add new files * better code format * remove unused ruby files * fix java test * remove unused js spec files * remove inline_response_default_test.dart * fix webclient tests * fix spring tests
This commit is contained in:
@@ -20,7 +20,7 @@ A switch when turned on will return a hash table of Response, StatusCode and Hea
|
||||
|
||||
.OUTPUTS
|
||||
|
||||
InlineResponseDefault
|
||||
FooGetDefaultResponse
|
||||
#>
|
||||
function Invoke-PSFooGet {
|
||||
[CmdletBinding()]
|
||||
@@ -57,7 +57,7 @@ function Invoke-PSFooGet {
|
||||
-QueryParameters $LocalVarQueryParameters `
|
||||
-FormParameters $LocalVarFormParameters `
|
||||
-CookieParameters $LocalVarCookieParameters `
|
||||
-ReturnType "InlineResponseDefault" `
|
||||
-ReturnType "FooGetDefaultResponse" `
|
||||
-IsBodyNullable $false
|
||||
|
||||
if ($WithHttpInfo.IsPresent) {
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#
|
||||
# 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 String
|
||||
No description available.
|
||||
.OUTPUTS
|
||||
|
||||
FooGetDefaultResponse<PSCustomObject>
|
||||
#>
|
||||
|
||||
function Initialize-PSFooGetDefaultResponse {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[PSCustomObject]
|
||||
${String}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating PSCustomObject: PSPetstore => PSFooGetDefaultResponse' | Write-Debug
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
|
||||
$PSO = [PSCustomObject]@{
|
||||
"string" = ${String}
|
||||
}
|
||||
|
||||
|
||||
return $PSO
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Convert from JSON to FooGetDefaultResponse<PSCustomObject>
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
Convert from JSON to FooGetDefaultResponse<PSCustomObject>
|
||||
|
||||
.PARAMETER Json
|
||||
|
||||
Json object
|
||||
|
||||
.OUTPUTS
|
||||
|
||||
FooGetDefaultResponse<PSCustomObject>
|
||||
#>
|
||||
function ConvertFrom-PSJsonToFooGetDefaultResponse {
|
||||
Param(
|
||||
[AllowEmptyString()]
|
||||
[string]$Json
|
||||
)
|
||||
|
||||
Process {
|
||||
'Converting JSON to PSCustomObject: PSPetstore => PSFooGetDefaultResponse' | Write-Debug
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$JsonParameters = ConvertFrom-Json -InputObject $Json
|
||||
|
||||
# check if Json contains properties not defined in PSFooGetDefaultResponse
|
||||
$AllProperties = ("string")
|
||||
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 "string"))) { #optional property not found
|
||||
$String = $null
|
||||
} else {
|
||||
$String = $JsonParameters.PSobject.Properties["string"].value
|
||||
}
|
||||
|
||||
$PSO = [PSCustomObject]@{
|
||||
"string" = ${String}
|
||||
}
|
||||
|
||||
return $PSO
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user