diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/api_doc.mustache index 97e5de1b6936..fe4aea216190 100644 --- a/modules/openapi-generator/src/main/resources/powershell-experimental/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/api_doc.mustache @@ -25,6 +25,9 @@ Method | HTTP request | Description ```powershell Import-Module -Name {{{packageName}}} +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + {{#hasAuthMethods}} $Configuration = Get-{{{packageName}}}Configuration {{#authMethods}} diff --git a/samples/client/petstore/powershell-experimental/Test1.ps1 b/samples/client/petstore/powershell-experimental/Test1.ps1 index 268665d81b1f..fc9a2c04963e 100644 --- a/samples/client/petstore/powershell-experimental/Test1.ps1 +++ b/samples/client/petstore/powershell-experimental/Test1.ps1 @@ -29,33 +29,37 @@ try { #Write-Host $pet $Result = Add-PSPet -Pet $pet Set-PSConfigurationApiKey -Id "api_key" -ApiKey "zzZZZZZZZZZZZZZ" - $result = Get-PSPetById -petId $Id -Verbose #-testHeader "testing only" -testQuery "testing something here" + #$result = Get-PSPetById -petId ($Id+1) -Verbose #-testHeader "testing only" -testQuery "testing something here" + #Write-Host "after get pet by id" } catch { - Write-Host ("Exception occured when calling '': {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Exception occured when calling: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) } +$result = Get-PSPetById -petId ($Id+1) -Verbose -WithHttpInfo #-testHeader "testing only" -testQuery "testing something here" +Write-Host "after get pet by id" +Write-Host $result.gettype() + #$result | Write-Host #$result | Select-Object -Property "photoUrls" | ConvertTo-Json | Write-Host #Write-Host "result =" + $result.photoUrls - -$pet2 = Initialize-PSPet -Id 20129 -Name '2foo' -Category ( - Initialize-PSCategory -Id 20129 -Name '2bar' -) -PhotoUrls @( - 'http://example.com/2foo', - 'http://example.com/2bar' -) -Tags ( - Initialize-PSTag -Id 3 -Name 'baz' -) -Status Available - -#Write-Host $pet -$Result = Add-PSPet -Pet $pet2 - -$Result = Find-PSPetsByTags 'baz' -Write-Host $Result.GetType().Name -Write-Host $Result +#$pet2 = Initialize-PSPet -Id 20129 -Name '2foo' -Category ( +# Initialize-PSCategory -Id 20129 -Name '2bar' +#) -PhotoUrls @( +# 'http://example.com/2foo', +# 'http://example.com/2bar' +#) -Tags ( +# Initialize-PSTag -Id 3 -Name 'baz' +#) -Status Available +# +##Write-Host $pet +#$Result = Add-PSPet -Pet $pet2 +# +#$Result = Find-PSPetsByTags 'baz' +#Write-Host $Result.GetType().Name +#Write-Host $Result #$Result = Invoke-PetApiUpdatePetWithForm -petId $Id -Name "PowerShell Update" -Status "Pending" diff --git a/samples/client/petstore/powershell-experimental/docs/PSPetApi.md b/samples/client/petstore/powershell-experimental/docs/PSPetApi.md index 78129e0be7bc..34163e80b385 100644 --- a/samples/client/petstore/powershell-experimental/docs/PSPetApi.md +++ b/samples/client/petstore/powershell-experimental/docs/PSPetApi.md @@ -25,6 +25,9 @@ Add a new pet to the store ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; @@ -73,6 +76,9 @@ Deletes a pet ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; @@ -124,6 +130,9 @@ Multiple status values can be provided with comma separated strings ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; @@ -173,6 +182,9 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; @@ -222,6 +234,9 @@ Returns a single pet ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: api_key $Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY" @@ -271,6 +286,9 @@ Update an existing pet ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; @@ -320,6 +338,9 @@ Updates a pet in the store with form data ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; @@ -373,6 +394,9 @@ uploads an image ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure OAuth2 access token for authorization: petstore_auth $Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; diff --git a/samples/client/petstore/powershell-experimental/docs/PSStoreApi.md b/samples/client/petstore/powershell-experimental/docs/PSStoreApi.md index bfb991c51291..f955282042bc 100644 --- a/samples/client/petstore/powershell-experimental/docs/PSStoreApi.md +++ b/samples/client/petstore/powershell-experimental/docs/PSStoreApi.md @@ -23,6 +23,9 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $OrderId = "OrderId_example" # String | ID of the order that needs to be deleted (default to null) # Delete purchase order by ID @@ -67,6 +70,9 @@ Returns a map of status codes to quantities ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: api_key $Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY" @@ -114,6 +120,9 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $OrderId = 987 # Int64 | ID of pet that needs to be fetched (default to null) # Find purchase order by ID @@ -157,6 +166,9 @@ Place an order for a pet ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Order = (Initialize-Order-Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "Status_example" -Complete $false) # Order | order placed for purchasing the pet # Place an order for a pet diff --git a/samples/client/petstore/powershell-experimental/docs/PSUserApi.md b/samples/client/petstore/powershell-experimental/docs/PSUserApi.md index 1b5de280e7df..1f888421a22d 100644 --- a/samples/client/petstore/powershell-experimental/docs/PSUserApi.md +++ b/samples/client/petstore/powershell-experimental/docs/PSUserApi.md @@ -27,6 +27,9 @@ This can only be done by the logged in user. ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: auth_cookie $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" @@ -76,6 +79,9 @@ Creates list of users with given input array ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: auth_cookie $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" @@ -125,6 +131,9 @@ Creates list of users with given input array ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: auth_cookie $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" @@ -176,6 +185,9 @@ This can only be done by the logged in user. ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: auth_cookie $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" @@ -225,6 +237,9 @@ Get user by user name ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Username = "Username_example" # String | The name that needs to be fetched. Use user1 for testing. (default to null) # Get user by user name @@ -269,6 +284,9 @@ Logs user into the system ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Username = "Username_example" # String | The user name for login (default to null) $Password = "Password_example" # String | The password for login in clear text (default to null) @@ -313,6 +331,9 @@ Logs out current logged in user session ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: auth_cookie $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" @@ -361,6 +382,9 @@ This can only be done by the logged in user. ```powershell Import-Module -Name PSPetstore +# Displays the error message and stops executing. (Default: Continue) +$ErrorActionPreference = "Stop" + $Configuration = Get-PSPetstoreConfiguration # Configure API key authorization: auth_cookie $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"