forked from loafle/openapi-generator-original
add additional properties support to powershell client generator (#6528)
This commit is contained in:
@@ -77,12 +77,14 @@ function ConvertFrom-PSJsonToTag {
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$JsonParameters = ConvertFrom-Json -InputObject $Json
|
||||
$PSTagAdditionalProperties = @{}
|
||||
|
||||
# check if Json contains properties not defined in PSTag
|
||||
$AllProperties = ("id", "name")
|
||||
foreach ($name in $JsonParameters.PsObject.Properties.Name) {
|
||||
# store undefined properties in additionalProperties
|
||||
if (!($AllProperties.Contains($name))) {
|
||||
throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
|
||||
$PSTagAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +103,7 @@ function ConvertFrom-PSJsonToTag {
|
||||
$PSO = [PSCustomObject]@{
|
||||
"id" = ${Id}
|
||||
"name" = ${Name}
|
||||
"AdditionalProperties" = $PSTagAdditionalProperties
|
||||
}
|
||||
|
||||
return $PSO
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Generated by: OpenAPI Generator Team
|
||||
#
|
||||
# Generated on: 5/19/20
|
||||
# Generated on: 6/3/20
|
||||
#
|
||||
|
||||
@{
|
||||
@@ -87,7 +87,8 @@ FunctionsToExport = 'Add-PSPet', 'Remove-Pet', 'Find-PSPetsByStatus', 'Find-PSPe
|
||||
'Set-PSConfiguration', 'Set-PSConfigurationApiKey',
|
||||
'Set-PSConfigurationApiKeyPrefix',
|
||||
'Set-PSConfigurationDefaultHeader', 'Get-PSHostSetting',
|
||||
'Get-PSUrlFromHostSetting'
|
||||
'Get-PSUrlFromHostSetting', 'Set-PSConfigurationHttpSigning',
|
||||
'Get-PSConfigurationHttpSigning'
|
||||
|
||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||
CmdletsToExport = @()
|
||||
|
||||
Reference in New Issue
Block a user