From eac18a779d8a48f9c001f0294a197ba8a2a94fc9 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 24 Mar 2020 15:04:36 +0800 Subject: [PATCH] [PowerShell][Experimental] Better docstring (#5688) * add docstring to powershell module * add doc string --- .../PowerShellExperimentalClientCodegen.java | 20 ++- .../powershell-experimental/api.mustache | 18 +++ .../configuration.mustache | 88 +++++++++++ .../powershell-experimental/model.mustache | 19 +++ .../powershell-experimental/docs/PSUserApi.md | 4 +- .../src/PSPetstore/API/PSPetApi.ps1 | 143 ++++++++++++++++++ .../src/PSPetstore/API/PSStoreApi.ps1 | 61 ++++++++ .../src/PSPetstore/API/PSUserApi.ps1 | 131 ++++++++++++++++ .../src/PSPetstore/Client/PSConfiguration.ps1 | 97 ++++++++++++ .../src/PSPetstore/Model/ApiResponse.ps1 | 23 +++ .../src/PSPetstore/Model/Category.ps1 | 20 +++ .../src/PSPetstore/Model/InlineObject.ps1 | 20 +++ .../src/PSPetstore/Model/InlineObject1.ps1 | 20 +++ .../src/PSPetstore/Model/Order.ps1 | 32 ++++ .../src/PSPetstore/Model/Pet.ps1 | 32 ++++ .../src/PSPetstore/Model/Tag.ps1 | 20 +++ .../src/PSPetstore/Model/User.ps1 | 38 +++++ .../src/PSPetstore/Private/PSApiClient.ps1 | 23 ++- 18 files changed, 796 insertions(+), 13 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java index 20a61fd4366..8b5abd37dbf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java @@ -594,7 +594,7 @@ public class PowerShellExperimentalClientCodegen extends DefaultCodegen implemen public Map postProcessOperationsWithModels(Map objs, List allModels) { Map operations = (Map) objs.get("operations"); HashMap modelMaps = new HashMap(); - HashMap processedModelMaps = new HashMap(); + HashMap processedModelMaps = new HashMap(); for (Object o : allModels) { HashMap h = (HashMap) o; @@ -672,7 +672,7 @@ public class PowerShellExperimentalClientCodegen extends DefaultCodegen implemen return name; } - private String constructExampleCode(CodegenParameter codegenParameter, HashMap modelMaps, HashMap processedModelMap) { + private String constructExampleCode(CodegenParameter codegenParameter, HashMap modelMaps, HashMap processedModelMap) { if (codegenParameter.isListContainer) { // array return "@(" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + ")"; } else if (codegenParameter.isMapContainer) { // TODO: map, file type @@ -714,7 +714,7 @@ public class PowerShellExperimentalClientCodegen extends DefaultCodegen implemen } } - private String constructExampleCode(CodegenProperty codegenProperty, HashMap modelMaps, HashMap processedModelMap) { + private String constructExampleCode(CodegenProperty codegenProperty, HashMap modelMaps, HashMap processedModelMap) { if (codegenProperty.isListContainer) { // array return "@(" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + ")"; } else if (codegenProperty.isMapContainer) { // map @@ -756,15 +756,23 @@ public class PowerShellExperimentalClientCodegen extends DefaultCodegen implemen } } - private String constructExampleCode(CodegenModel codegenModel, HashMap modelMaps, HashMap processedModelMap) { + private String constructExampleCode(CodegenModel codegenModel, HashMap modelMaps, HashMap processedModelMap) { String example; // break infinite recursion. Return, in case a model is already processed in the current context. String model = codegenModel.name; if (processedModelMap.containsKey(model)) { - return ""; + int count = processedModelMap.get(model); + if (count == 1) { + processedModelMap.put(model, 2); + } else if (count == 2) { + return ""; + } else { + throw new RuntimeException("Invalid count when constructing example: " + count); + } + } else { + processedModelMap.put(model, 1); } - processedModelMap.put(model, true); example = "(New-" + codegenModel.name; List propertyExamples = new ArrayList<>(); diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/api.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/api.mustache index 60955ee8661..12a1d0c18fb 100644 --- a/modules/openapi-generator/src/main/resources/powershell-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/api.mustache @@ -1,6 +1,24 @@ {{> partial_header}} {{#operations}} {{#operation}} +<# +.SYNOPSIS + +{{#summary}}{{{.}}}{{/summary}}{{^summary}}No summary available.{{/summary}} + +.DESCRIPTION + +{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}} + +{{#allParams}} +.PARAMETER {{{paramName}}} +{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}} + +{{/allParams}} +.OUTPUTS + +{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}None{{/returnType}} +#> function {{{vendorExtensions.x-powershell-method-name}}} { [CmdletBinding()] Param ( diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/configuration.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/configuration.mustache index 029bdcb549b..69d92b1e6fc 100644 --- a/modules/openapi-generator/src/main/resources/powershell-experimental/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/configuration.mustache @@ -1,4 +1,17 @@ {{> partial_header}} +<# +.SYNOPSIS + +Get the configuration object '{{apiNamePrefix}}Configuration'. + +.DESCRIPTION + +Get the configuration object '{{apiNamePrefix}}Configuration'. + +.OUTPUTS + +System.Collections.Hashtable +#> function Get-{{apiNamePrefix}}Configuration { $Configuration = $Script:Configuration @@ -36,6 +49,43 @@ function Get-{{apiNamePrefix}}Configuration { } +<# +.SYNOPSIS + +Set the configuration. + +.DESCRIPTION + +Set the configuration. + +.PARAMETER BaseUrl +Base URL of the HTTP endpoints + +.PARAMETER Username +Username in HTTP basic authentication + +.PARAMETER Passowrd +Password in HTTP basic authentication + +.PARAMETER ApiKey +API Keys for authentication/authorization + +.PARAMETER ApiKeyPrefix +Prefix in the API Keys + +.PARAMETER Cookie +Cookie for authentication/authorization + +.PARAMETER AccessToken +Access token for authentication/authorization + +.PARAMETER SkipCertificateCheck +Skip certificate verification + +.OUTPUTS + +System.Collections.Hashtable +#> function Set-{{{apiNamePrefix}}}Configuration { [CmdletBinding()] @@ -92,6 +142,25 @@ function Set-{{{apiNamePrefix}}}Configuration { } } +<# +.SYNOPSIS + +Set the API Key. + +.DESCRIPTION + +Set the API Key. + +.PARAMETER Id +ID of the security schema + +.PARAMETER ApiKey +API Key + +.OUTPUTS + +None +#> function Set-{{{apiNamePrefix}}}ConfigurationApiKey { [CmdletBinding()] Param( @@ -107,6 +176,25 @@ function Set-{{{apiNamePrefix}}}ConfigurationApiKey { } } +<# +.SYNOPSIS + +Set the API Key prefix. + +.DESCRIPTION + +Set the API Key prefix. + +.PARAMETER Id +ID of the security schema + +.PARAMETER ApiKey +API Key prefix + +.OUTPUTS + +None +#> function Set-{{{apiNamePrefix}}}ConfigurationApiKeyPrefix { [CmdletBinding()] Param( diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/model.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/model.mustache index 4dc8ea4028e..10b8de2f1b1 100644 --- a/modules/openapi-generator/src/main/resources/powershell-experimental/model.mustache +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/model.mustache @@ -1,6 +1,25 @@ {{> partial_header}} {{#models}} {{#model}} +<# +.SYNOPSIS + +{{#summary}}{{{.}}}{{/summary}}{{^summary}}No summary available.{{/summary}} + +.DESCRIPTION + +{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}} + +{{#vars}} +.PARAMETER {{{name}}} +{{#description}}{{{description}}}{{/description}}{{^description}}No description available.{{/description}} + +{{/vars}} +.OUTPUTS + +{{{classname}}} +#> + function New-{{{apiNamePrefix}}}{{{classname}}} { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/docs/PSUserApi.md b/samples/client/petstore/powershell-experimental/docs/PSUserApi.md index 77a95dd1791..e1a41da0b1a 100644 --- a/samples/client/petstore/powershell-experimental/docs/PSUserApi.md +++ b/samples/client/petstore/powershell-experimental/docs/PSUserApi.md @@ -131,7 +131,7 @@ $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed #$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" -$User = @((New-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)) # User[] | List of user object +$User = @() # User[] | List of user object # Creates list of users with given input array try { @@ -368,7 +368,7 @@ $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" #$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" $Username = "Username_example" # String | name that need to be deleted (default to null) -$User = (New-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123) # User | Updated user object +$User = # User | Updated user object # Updated user try { diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSPetApi.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSPetApi.ps1 index 7bbc0128145..3df26a59eef 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSPetApi.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSPetApi.ps1 @@ -5,6 +5,22 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +Add a new pet to the store + +.DESCRIPTION + +No description available. + +.PARAMETER Pet +Pet object that needs to be added to the store + +.OUTPUTS + +Pet +#> function Add-PSPet { [CmdletBinding()] Param ( @@ -57,6 +73,25 @@ function Add-PSPet { } } +<# +.SYNOPSIS + +Deletes a pet + +.DESCRIPTION + +No description available. + +.PARAMETER PetId +Pet id to delete + +.PARAMETER ApiKey +No description available. + +.OUTPUTS + +None +#> function Remove-Pet { [CmdletBinding()] Param ( @@ -108,6 +143,22 @@ function Remove-Pet { } } +<# +.SYNOPSIS + +Finds Pets by status + +.DESCRIPTION + +No description available. + +.PARAMETER Status +Status values that need to be considered for filter + +.OUTPUTS + +Pet[] +#> function Find-PSPetsByStatus { [CmdletBinding()] Param ( @@ -156,6 +207,22 @@ function Find-PSPetsByStatus { } } +<# +.SYNOPSIS + +Finds Pets by tags + +.DESCRIPTION + +No description available. + +.PARAMETER Tags +Tags to filter by + +.OUTPUTS + +Pet[] +#> function Find-PSPetsByTags { [CmdletBinding()] Param ( @@ -204,6 +271,22 @@ function Find-PSPetsByTags { } } +<# +.SYNOPSIS + +Find pet by ID + +.DESCRIPTION + +No description available. + +.PARAMETER PetId +ID of pet to return + +.OUTPUTS + +Pet +#> function Get-PSPetById { [CmdletBinding()] Param ( @@ -254,6 +337,22 @@ function Get-PSPetById { } } +<# +.SYNOPSIS + +Update an existing pet + +.DESCRIPTION + +No description available. + +.PARAMETER Pet +Pet object that needs to be added to the store + +.OUTPUTS + +Pet +#> function Update-PSPet { [CmdletBinding()] Param ( @@ -306,6 +405,28 @@ function Update-PSPet { } } +<# +.SYNOPSIS + +Updates a pet in the store with form data + +.DESCRIPTION + +No description available. + +.PARAMETER PetId +ID of pet that needs to be updated + +.PARAMETER Name +Updated name of the pet + +.PARAMETER Status +Updated status of the pet + +.OUTPUTS + +None +#> function Update-PSPetWithForm { [CmdletBinding()] Param ( @@ -367,6 +488,28 @@ function Update-PSPetWithForm { } } +<# +.SYNOPSIS + +uploads an image + +.DESCRIPTION + +No description available. + +.PARAMETER PetId +ID of pet to update + +.PARAMETER AdditionalMetadata +Additional data to pass to server + +.PARAMETER File +file to upload + +.OUTPUTS + +ApiResponse +#> function Invoke-PSUploadFile { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSStoreApi.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSStoreApi.ps1 index 3dfb8c00d6b..577a91767d0 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSStoreApi.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSStoreApi.ps1 @@ -5,6 +5,22 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +Delete purchase order by ID + +.DESCRIPTION + +No description available. + +.PARAMETER OrderId +ID of the order that needs to be deleted + +.OUTPUTS + +None +#> function Invoke-PSDeleteOrder { [CmdletBinding()] Param ( @@ -48,6 +64,19 @@ function Invoke-PSDeleteOrder { } } +<# +.SYNOPSIS + +Returns pet inventories by status + +.DESCRIPTION + +No description available. + +.OUTPUTS + +Hashtable +#> function Get-PSInventory { [CmdletBinding()] Param ( @@ -91,6 +120,22 @@ function Get-PSInventory { } } +<# +.SYNOPSIS + +Find purchase order by ID + +.DESCRIPTION + +No description available. + +.PARAMETER OrderId +ID of pet that needs to be fetched + +.OUTPUTS + +Order +#> function Get-PSOrderById { [CmdletBinding()] Param ( @@ -137,6 +182,22 @@ function Get-PSOrderById { } } +<# +.SYNOPSIS + +Place an order for a pet + +.DESCRIPTION + +No description available. + +.PARAMETER Order +order placed for purchasing the pet + +.OUTPUTS + +Order +#> function Invoke-PSPlaceOrder { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSUserApi.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSUserApi.ps1 index f6b2d3ae67a..db881ca4d7e 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSUserApi.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/API/PSUserApi.ps1 @@ -5,6 +5,22 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +Create user + +.DESCRIPTION + +No description available. + +.PARAMETER User +Created user object + +.OUTPUTS + +None +#> function Invoke-PSCreateUser { [CmdletBinding()] Param ( @@ -57,6 +73,22 @@ function Invoke-PSCreateUser { } } +<# +.SYNOPSIS + +Creates list of users with given input array + +.DESCRIPTION + +No description available. + +.PARAMETER User +List of user object + +.OUTPUTS + +None +#> function Invoke-PSCreateUsersWithArrayInput { [CmdletBinding()] Param ( @@ -109,6 +141,22 @@ function Invoke-PSCreateUsersWithArrayInput { } } +<# +.SYNOPSIS + +Creates list of users with given input array + +.DESCRIPTION + +No description available. + +.PARAMETER User +List of user object + +.OUTPUTS + +None +#> function Invoke-PSCreateUsersWithListInput { [CmdletBinding()] Param ( @@ -161,6 +209,22 @@ function Invoke-PSCreateUsersWithListInput { } } +<# +.SYNOPSIS + +Delete user + +.DESCRIPTION + +No description available. + +.PARAMETER Username +The name that needs to be deleted + +.OUTPUTS + +None +#> function Invoke-PSDeleteUser { [CmdletBinding()] Param ( @@ -208,6 +272,22 @@ function Invoke-PSDeleteUser { } } +<# +.SYNOPSIS + +Get user by user name + +.DESCRIPTION + +No description available. + +.PARAMETER Username +The name that needs to be fetched. Use user1 for testing. + +.OUTPUTS + +User +#> function Get-PSUserByName { [CmdletBinding()] Param ( @@ -254,6 +334,25 @@ function Get-PSUserByName { } } +<# +.SYNOPSIS + +Logs user into the system + +.DESCRIPTION + +No description available. + +.PARAMETER Username +The user name for login + +.PARAMETER Password +The password for login in clear text + +.OUTPUTS + +String +#> function Invoke-PSLoginUser { [CmdletBinding()] Param ( @@ -309,6 +408,19 @@ function Invoke-PSLoginUser { } } +<# +.SYNOPSIS + +Logs out current logged in user session + +.DESCRIPTION + +No description available. + +.OUTPUTS + +None +#> function Invoke-PSLogoutUser { [CmdletBinding()] Param ( @@ -349,6 +461,25 @@ function Invoke-PSLogoutUser { } } +<# +.SYNOPSIS + +Updated user + +.DESCRIPTION + +No description available. + +.PARAMETER Username +name that need to be deleted + +.PARAMETER User +Updated user object + +.OUTPUTS + +None +#> function Update-PSUser { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Client/PSConfiguration.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Client/PSConfiguration.ps1 index 32568f34657..17f463156cf 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Client/PSConfiguration.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Client/PSConfiguration.ps1 @@ -5,6 +5,19 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +Get the configuration object 'PSConfiguration'. + +.DESCRIPTION + +Get the configuration object 'PSConfiguration'. + +.OUTPUTS + +System.Collections.Hashtable +#> function Get-PSConfiguration { $Configuration = $Script:Configuration @@ -34,10 +47,51 @@ function Get-PSConfiguration { $Configuration["ApiKeyPrefix"] = @{} } + if (!$Configuration.containsKey("SkipCertificateCheck")) { + $Configuration["SkipCertificateCheck"] = $false + } + Return $Configuration } +<# +.SYNOPSIS + +Set the configuration. + +.DESCRIPTION + +Set the configuration. + +.PARAMETER BaseUrl +Base URL of the HTTP endpoints + +.PARAMETER Username +Username in HTTP basic authentication + +.PARAMETER Passowrd +Password in HTTP basic authentication + +.PARAMETER ApiKey +API Keys for authentication/authorization + +.PARAMETER ApiKeyPrefix +Prefix in the API Keys + +.PARAMETER Cookie +Cookie for authentication/authorization + +.PARAMETER AccessToken +Access token for authentication/authorization + +.PARAMETER SkipCertificateCheck +Skip certificate verification + +.OUTPUTS + +System.Collections.Hashtable +#> function Set-PSConfiguration { [CmdletBinding()] @@ -54,6 +108,7 @@ function Set-PSConfiguration { [AllowEmptyString()] [string]$AccessToken, [switch]$PassThru, + [bool]$SkipCertificateCheck, [switch]$Force ) @@ -86,9 +141,32 @@ function Set-PSConfiguration { If ($AccessToken) { $Script:Configuration['AccessToken'] = $AccessToken } + + If ($SkipCertificateCheck) { + $Script:Configuration['SkipCertificateCheck'] = $SkipCertificateCheck + } } } +<# +.SYNOPSIS + +Set the API Key. + +.DESCRIPTION + +Set the API Key. + +.PARAMETER Id +ID of the security schema + +.PARAMETER ApiKey +API Key + +.OUTPUTS + +None +#> function Set-PSConfigurationApiKey { [CmdletBinding()] Param( @@ -104,6 +182,25 @@ function Set-PSConfigurationApiKey { } } +<# +.SYNOPSIS + +Set the API Key prefix. + +.DESCRIPTION + +Set the API Key prefix. + +.PARAMETER Id +ID of the security schema + +.PARAMETER ApiKey +API Key prefix + +.OUTPUTS + +None +#> function Set-PSConfigurationApiKeyPrefix { [CmdletBinding()] Param( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/ApiResponse.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/ApiResponse.ps1 index 70c6321027b..cdc16c1061b 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/ApiResponse.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/ApiResponse.ps1 @@ -5,6 +5,29 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +Describes the result of uploading an image resource + +.PARAMETER Code +No description available. + +.PARAMETER Type +No description available. + +.PARAMETER Message +No description available. + +.OUTPUTS + +ApiResponse +#> + function New-PSApiResponse { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Category.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Category.ps1 index 212b1078995..97a5cb5727f 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Category.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Category.ps1 @@ -5,6 +5,26 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +A category for a pet + +.PARAMETER Id +No description available. + +.PARAMETER Name +No description available. + +.OUTPUTS + +Category +#> + function New-PSCategory { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject.ps1 index 7feb2304799..2bfa65d959c 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject.ps1 @@ -5,6 +5,26 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Name +Updated name of the pet + +.PARAMETER Status +Updated status of the pet + +.OUTPUTS + +InlineObject +#> + function New-PSInlineObject { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject1.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject1.ps1 index 596fbd422f5..26f78089661 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject1.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/InlineObject1.ps1 @@ -5,6 +5,26 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER AdditionalMetadata +Additional data to pass to server + +.PARAMETER File +file to upload + +.OUTPUTS + +InlineObject1 +#> + function New-PSInlineObject1 { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Order.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Order.ps1 index 30e780540e6..e094395a50a 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Order.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Order.ps1 @@ -5,6 +5,38 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +An order for a pets from the pet store + +.PARAMETER Id +No description available. + +.PARAMETER PetId +No description available. + +.PARAMETER Quantity +No description available. + +.PARAMETER ShipDate +No description available. + +.PARAMETER Status +Order Status + +.PARAMETER Complete +No description available. + +.OUTPUTS + +Order +#> + function New-PSOrder { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Pet.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Pet.ps1 index 8367470d4ab..e3350562701 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Pet.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Pet.ps1 @@ -5,6 +5,38 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +A pet for sale in the pet store + +.PARAMETER Id +No description available. + +.PARAMETER Category +No description available. + +.PARAMETER Name +No description available. + +.PARAMETER PhotoUrls +No description available. + +.PARAMETER Tags +No description available. + +.PARAMETER Status +pet status in the store + +.OUTPUTS + +Pet +#> + function New-PSPet { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Tag.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Tag.ps1 index 9dff57b3e7c..1b425d8c476 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Tag.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/Tag.ps1 @@ -5,6 +5,26 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +A tag for a pet + +.PARAMETER Id +No description available. + +.PARAMETER Name +No description available. + +.OUTPUTS + +Tag +#> + function New-PSTag { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/User.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/User.ps1 index 591da29b85e..91f521c101b 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/User.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Model/User.ps1 @@ -5,6 +5,44 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +A User who is purchasing from the pet store + +.PARAMETER Id +No description available. + +.PARAMETER Username +No description available. + +.PARAMETER FirstName +No description available. + +.PARAMETER LastName +No description available. + +.PARAMETER Email +No description available. + +.PARAMETER Password +No description available. + +.PARAMETER Phone +No description available. + +.PARAMETER UserStatus +User Status + +.OUTPUTS + +User +#> + function New-PSUser { [CmdletBinding()] Param ( diff --git a/samples/client/petstore/powershell-experimental/src/PSPetstore/Private/PSApiClient.ps1 b/samples/client/petstore/powershell-experimental/src/PSPetstore/Private/PSApiClient.ps1 index b8195939d31..a2a238cf119 100644 --- a/samples/client/petstore/powershell-experimental/src/PSPetstore/Private/PSApiClient.ps1 +++ b/samples/client/petstore/powershell-experimental/src/PSPetstore/Private/PSApiClient.ps1 @@ -40,14 +40,17 @@ function Invoke-PSApiClient { $Configuration = Get-PSConfiguration $RequestUri = $Configuration["BaseUrl"] + $Uri + $SkipCertificateCheck = $Configuration["SkipCertificateCheck"] # cookie parameters - foreach ($Parameter in $CookieParameters) { - if ($CookieParameters[$Parameter]) { - $HeaderParameters["Cookie"] = $CookieParameters[$Parameter] + foreach ($Parameter in $CookieParameters.GetEnumerator()) { + if ($Parameter.Name -eq "cookieAuth") { + $HeaderParameters["Cookie"] = $Parameter.Value + } else { + $HeaderParameters[$Parameter.Name] = $Parameter.Value } } - if ($CookieParametters -and $CookieParameters.Count -gt 1) { + if ($CookieParameters -and $CookieParameters.Count -gt 1) { Write-Warning "Multipe cookie parameters found. Curently only the first one is supported/used" } @@ -86,11 +89,21 @@ function Invoke-PSApiClient { $RequestBody = $Body } - $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` + if ($SkipCertificateCheck -eq $true) { + $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` + -Method $Method ` + -Headers $HeaderParameters ` + -Body $RequestBody ` + -ErrorAction Stop ` + -SkipCertificateCheck + + } else { + $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` -Method $Method ` -Headers $HeaderParameters ` -Body $RequestBody ` -ErrorAction Stop + } return @{ Response = DeserializeResponse -Response $Response -ReturnType $ReturnType