From 1ecc63ed82f15fce475cdb1e3374ea2687ce9f67 Mon Sep 17 00:00:00 2001
From: Author <>
Date: Fri, 26 Jun 2020 12:29:20 +0530
Subject: [PATCH] fix the json depth for nested object

---
 .../src/main/resources/powershell/api.mustache            | 6 +++---
 .../petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1   | 4 ++--
 .../petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 | 2 +-
 .../petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1  | 8 ++++----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/powershell/api.mustache b/modules/openapi-generator/src/main/resources/powershell/api.mustache
index ba001e99c33..114d14c81ce 100644
--- a/modules/openapi-generator/src/main/resources/powershell/api.mustache
+++ b/modules/openapi-generator/src/main/resources/powershell/api.mustache
@@ -172,7 +172,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
 
         {{/isNullable}}
         {{/required}}
-        $LocalVarBodyParameter = ${{{paramName}}} | ConvertTo-Json
+        $LocalVarBodyParameter = ${{{paramName}}} | ConvertTo-Json -Depth 100
 
         {{/bodyParam}}
         {{#authMethods}}
@@ -225,12 +225,12 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
 
         {{#vendorExtensions.x-ps-return-type-one-of}}
         # process oneOf response
-        $LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"])
+        $LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"] -Depth 100)
 
         {{/vendorExtensions.x-ps-return-type-one-of}}
         {{#vendorExtensions.x-ps-return-type-any-of}}
         # process anyOf response
-        $LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"])
+        $LocalVarResult["Response"] = ConvertFrom-{{apiNamePrefix}}JsonTo{{returnType}} (ConvertTo-Json $LocalVarResult["Response"] -Depth 100)
 
         {{/vendorExtensions.x-ps-return-type-any-of}}
         if ($WithHttpInfo.IsPresent) {
diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1
index f7833bd5e69..fd9df6cce81 100644
--- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1
+++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1
@@ -73,7 +73,7 @@ function Add-PSPet {
             throw "Error! The required parameter `Pet` missing when calling addPet."
         }
 
-        $LocalVarBodyParameter = $Pet | ConvertTo-Json
+        $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100
 
 
         $LocalVarResult = Invoke-PSApiClient -Method 'POST' `
@@ -505,7 +505,7 @@ function Update-PSPet {
             throw "Error! The required parameter `Pet` missing when calling updatePet."
         }
 
-        $LocalVarBodyParameter = $Pet | ConvertTo-Json
+        $LocalVarBodyParameter = $Pet | ConvertTo-Json -Depth 100
 
 
         $LocalVarResult = Invoke-PSApiClient -Method 'PUT' `
diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1
index b6f3645d533..dc4ffa2b974 100644
--- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1
+++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSStoreApi.ps1
@@ -293,7 +293,7 @@ function Invoke-PSPlaceOrder {
             throw "Error! The required parameter `Order` missing when calling placeOrder."
         }
 
-        $LocalVarBodyParameter = $Order | ConvertTo-Json
+        $LocalVarBodyParameter = $Order | ConvertTo-Json -Depth 100
 
         $LocalVarResult = Invoke-PSApiClient -Method 'POST' `
                                 -Uri $LocalVarUri `
diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1
index 57422ca50a7..e6fb9a8e081 100644
--- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1
+++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSUserApi.ps1
@@ -58,7 +58,7 @@ function New-PSUser {
             throw "Error! The required parameter `User` missing when calling createUser."
         }
 
-        $LocalVarBodyParameter = $User | ConvertTo-Json
+        $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100
 
         if ($Configuration["Cookie"]) {
             $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
@@ -137,7 +137,7 @@ function New-PSUsersWithArrayInput {
             throw "Error! The required parameter `User` missing when calling createUsersWithArrayInput."
         }
 
-        $LocalVarBodyParameter = $User | ConvertTo-Json
+        $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100
 
         if ($Configuration["Cookie"]) {
             $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
@@ -216,7 +216,7 @@ function New-PSUsersWithListInput {
             throw "Error! The required parameter `User` missing when calling createUsersWithListInput."
         }
 
-        $LocalVarBodyParameter = $User | ConvertTo-Json
+        $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100
 
         if ($Configuration["Cookie"]) {
             $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
@@ -623,7 +623,7 @@ function Update-PSUser {
             throw "Error! The required parameter `User` missing when calling updateUser."
         }
 
-        $LocalVarBodyParameter = $User | ConvertTo-Json
+        $LocalVarBodyParameter = $User | ConvertTo-Json -Depth 100
 
         if ($Configuration["Cookie"]) {
             $LocalVarCookieParameters['auth_cookie'] = $Configuration["Cookie"]
-- 
GitLab