Skip to content

Commit 372894d

Browse files
authored
Add powershell echo test, rename api key names (#17043)
* add powershell echo test, rename api key names * update
1 parent 6917aad commit 372894d

74 files changed

Lines changed: 6875 additions & 19 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
generatorName: powershell
2+
outputDir: samples/client/echo_api/powershell
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/powershell
5+
additionalProperties:
6+
hideGenerationTimestamp: "true"
7+
packageGuid: a27b908d-2a20-467f-bc32-af6f3a654ac5

modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,11 +1206,11 @@ components:
12061206
'read:pets': read your pets
12071207
api_key:
12081208
type: apiKey
1209-
name: api_key
1209+
name: api_key_name
12101210
in: header
12111211
api_key_query:
12121212
type: apiKey
1213-
name: api_key_query
1213+
name: api_key_query_name
12141214
in: query
12151215
http_basic_test:
12161216
type: http
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Build.ps1
2+
README.md
3+
appveyor.yml
4+
docs/AuthApi.md
5+
docs/Bird.md
6+
docs/BodyApi.md
7+
docs/Category.md
8+
docs/DataQuery.md
9+
docs/DefaultValue.md
10+
docs/FormApi.md
11+
docs/HeaderApi.md
12+
docs/NumberPropertiesOnly.md
13+
docs/PathApi.md
14+
docs/Pet.md
15+
docs/Query.md
16+
docs/QueryApi.md
17+
docs/StringEnumRef.md
18+
docs/Tag.md
19+
docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
20+
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
21+
src/PSOpenAPITools/Api/AuthApi.ps1
22+
src/PSOpenAPITools/Api/BodyApi.ps1
23+
src/PSOpenAPITools/Api/FormApi.ps1
24+
src/PSOpenAPITools/Api/HeaderApi.ps1
25+
src/PSOpenAPITools/Api/PathApi.ps1
26+
src/PSOpenAPITools/Api/QueryApi.ps1
27+
src/PSOpenAPITools/Client/Configuration.ps1
28+
src/PSOpenAPITools/Model/Bird.ps1
29+
src/PSOpenAPITools/Model/Category.ps1
30+
src/PSOpenAPITools/Model/DataQuery.ps1
31+
src/PSOpenAPITools/Model/DefaultValue.ps1
32+
src/PSOpenAPITools/Model/NumberPropertiesOnly.ps1
33+
src/PSOpenAPITools/Model/Pet.ps1
34+
src/PSOpenAPITools/Model/Query.ps1
35+
src/PSOpenAPITools/Model/StringEnumRef.ps1
36+
src/PSOpenAPITools/Model/Tag.ps1
37+
src/PSOpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ps1
38+
src/PSOpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ps1
39+
src/PSOpenAPITools/PSOpenAPITools.psm1
40+
src/PSOpenAPITools/Private/ApiClient.ps1
41+
src/PSOpenAPITools/Private/Get-CommonParameters.ps1
42+
src/PSOpenAPITools/Private/HttpSignatureAuth.ps1
43+
src/PSOpenAPITools/Private/Out-DebugParameter.ps1
44+
src/PSOpenAPITools/Private/RSAEncryptionProvider.cs
45+
src/PSOpenAPITools/en-US/about_PSOpenAPITools.help.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.1.0-SNAPSHOT
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#
2+
# Echo Server API
3+
# Echo Server API
4+
# Version: 0.1.0
5+
# Contact: team@openapitools.org
6+
# Generated by OpenAPI Generator: https://openapi-generator.tech
7+
#
8+
9+
function Get-FunctionsToExport {
10+
[CmdletBinding()]
11+
Param (
12+
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
13+
[ValidateNotNullOrEmpty()]
14+
[Alias('FullName')]
15+
$Path
16+
)
17+
18+
Process {
19+
$Token = $null
20+
$ParserErr = $null
21+
22+
$Ast = [System.Management.Automation.Language.Parser]::ParseFile(
23+
$Path,
24+
[ref]$Token,
25+
[ref]$ParserErr
26+
)
27+
28+
if ($ParserErr) {
29+
throw $ParserErr
30+
} else {
31+
foreach ($name in 'Begin', 'Process', 'End') {
32+
foreach ($Statement in $Ast."${name}Block".Statements) {
33+
if (
34+
[String]::IsNullOrWhiteSpace($Statement.Name) -or
35+
$Statement.Extent.ToString() -notmatch
36+
('function\W+{0}' -f $Statement.Name)
37+
) {
38+
continue
39+
}
40+
41+
$Statement.Name
42+
}
43+
}
44+
}
45+
}
46+
}
47+
48+
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
49+
$FunctionPath = 'Api', 'Model', 'Client' | ForEach-Object {Join-Path "$ScriptDir\src\PSOpenAPITools\" $_}
50+
51+
$Manifest = @{
52+
Path = "$ScriptDir\src\PSOpenAPITools\PSOpenAPITools.psd1"
53+
54+
Author = 'OpenAPI Generator Team'
55+
CompanyName = 'openapitools.org'
56+
Description = 'PSOpenAPITools - the PowerShell module for Echo Server API'
57+
58+
ModuleVersion = '0.1.2'
59+
60+
RootModule = 'PSOpenAPITools.psm1'
61+
Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module
62+
63+
PowerShellVersion = '6.2'
64+
65+
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
66+
67+
VariablesToExport = @()
68+
AliasesToExport = @()
69+
CmdletsToExport = @()
70+
71+
}
72+
73+
New-ModuleManifest @Manifest
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# PSOpenAPITools - the PowerShell module for the Echo Server API
2+
3+
Echo Server API
4+
5+
This PowerShell module is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
6+
7+
- API version: 0.1.0
8+
- SDK version: 0.1.2
9+
- Build package: org.openapitools.codegen.languages.PowerShellClientCodegen
10+
11+
<a id="frameworks-supported"></a>
12+
## Frameworks supported
13+
- PowerShell 6.2 or later
14+
15+
<a id="dependencies"></a>
16+
## Dependencies
17+
18+
<a id="installation"></a>
19+
## Installation
20+
21+
22+
To install from the source, run the following command to build and install the PowerShell module locally:
23+
```powershell
24+
Build.ps1
25+
Import-Module -Name '.\src\PSOpenAPITools' -Verbose
26+
```
27+
28+
To avoid function name collision, one can use `-Prefix`, e.g. `Import-Module -Name '.\src\PSOpenAPITools' -Prefix prefix`
29+
30+
To uninstall the module, simply run:
31+
```powershell
32+
Remove-Module -FullyQualifiedName @{ModuleName = "PSOpenAPITools"; ModuleVersion = "0.1.2"}
33+
```
34+
35+
<a id="tests"></a>
36+
## Tests
37+
38+
To install and run `Pester`, please execute the following commands in the terminal:
39+
40+
```powershell
41+
Install-module -name Pester -force
42+
43+
Invoke-Pester
44+
```
45+
46+
For troubleshooting, please run `$DebugPreference = 'Continue'` to turn on debugging and disable it with `$DebugPreference = 'SilentlyContinue'` when done with the troubleshooting.
47+
48+
## Documentation for API Endpoints
49+
50+
All URIs are relative to *http://localhost:3000*
51+
52+
Class | Method | HTTP request | Description
53+
------------ | ------------- | ------------- | -------------
54+
*AuthApi* | [**Test-AuthHttpBasic**](docs/AuthApi.md#Test-AuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
55+
*BodyApi* | [**Test-BinaryGif**](docs/BodyApi.md#Test-BinaryGif) | **POST** /binary/gif | Test binary (gif) response body
56+
*BodyApi* | [**Test-BodyApplicationOctetstreamBinary**](docs/BodyApi.md#Test-BodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
57+
*BodyApi* | [**Test-BodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#Test-BodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
58+
*BodyApi* | [**Test-EchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#Test-EchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
59+
*BodyApi* | [**Test-EchoBodyPet**](docs/BodyApi.md#Test-EchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
60+
*BodyApi* | [**Test-EchoBodyPetResponseString**](docs/BodyApi.md#Test-EchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
61+
*BodyApi* | [**Test-EchoBodyTagResponseString**](docs/BodyApi.md#Test-EchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
62+
*BodyApi* | [**Test-EchoBodyAllOfPet**](docs/BodyApi.md#Test-EchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
63+
*FormApi* | [**Test-FormIntegerBooleanString**](docs/FormApi.md#Test-FormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
64+
*FormApi* | [**Test-FormOneof**](docs/FormApi.md#Test-FormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
65+
*HeaderApi* | [**Test-HeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#Test-HeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
66+
*PathApi* | [**Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#Test-sPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
67+
*QueryApi* | [**Test-EnumRefString**](docs/QueryApi.md#Test-EnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)
68+
*QueryApi* | [**Test-QueryDatetimeDateString**](docs/QueryApi.md#Test-QueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s)
69+
*QueryApi* | [**Test-QueryIntegerBooleanString**](docs/QueryApi.md#Test-QueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
70+
*QueryApi* | [**Test-QueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#Test-QueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
71+
*QueryApi* | [**Test-QueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#Test-QueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
72+
*QueryApi* | [**Test-QueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#Test-QueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
73+
*QueryApi* | [**Test-QueryStyleFormExplodeTrueObject**](docs/QueryApi.md#Test-QueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
74+
*QueryApi* | [**Test-QueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#Test-QueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
75+
76+
77+
## Documentation for Models
78+
79+
- [PSOpenAPITools\Model.Bird](docs/Bird.md)
80+
- [PSOpenAPITools\Model.Category](docs/Category.md)
81+
- [PSOpenAPITools\Model.DataQuery](docs/DataQuery.md)
82+
- [PSOpenAPITools\Model.DefaultValue](docs/DefaultValue.md)
83+
- [PSOpenAPITools\Model.NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
84+
- [PSOpenAPITools\Model.Pet](docs/Pet.md)
85+
- [PSOpenAPITools\Model.Query](docs/Query.md)
86+
- [PSOpenAPITools\Model.StringEnumRef](docs/StringEnumRef.md)
87+
- [PSOpenAPITools\Model.Tag](docs/Tag.md)
88+
- [PSOpenAPITools\Model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
89+
- [PSOpenAPITools\Model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
90+
91+
92+
<a id="documentation-for-authorization"></a>
93+
## Documentation for Authorization
94+
95+
96+
Authentication schemes defined for the API:
97+
<a id="http_auth"></a>
98+
### http_auth
99+
100+
101+
- **Type**: HTTP basic authentication
102+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Echo Server API
3+
# Echo Server API
4+
# Version: 0.1.0
5+
# Contact: team@openapitools.org
6+
# Generated by OpenAPI Generator: https://openapi-generator.tech
7+
#
8+
9+
version: 1.0.{build}
10+
image:
11+
- Visual Studio 2019 # PWSH 7.x
12+
#- Visual Studio 2017 # PS 5.x, PWSH 6.x
13+
#- Ubuntu # PWSH 6.x
14+
# ref: https://www.appveyor.com/docs/windows-images-software/
15+
install:
16+
- pwsh: $PSVersionTable.PSVersion
17+
- pwsh: Install-Module Pester -Force -Scope CurrentUser
18+
build: off
19+
test_script:
20+
- pwsh: |
21+
.\Build.ps1
22+
Import-Module -Name '.\src\PSOpenAPITools'
23+
$Result = Invoke-Pester -PassThru
24+
if ($Result.FailedCount -gt 0) {
25+
$host.SetShouldExit($Result.FailedCount)
26+
exit $Result.FailedCount
27+
}
28+
deploy_script:
29+
- pwsh: |
30+
if ($env:APPVEYOR_REPO_TAG -eq $true -and $null -ne $env:NuGetApiKey) {
31+
.\Build.ps1
32+
try {
33+
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\PSOpenAPITools\ -Confirm:$False -Verbose
34+
Write-Host "Successfully published the PowerShell module."
35+
} catch {
36+
$host.SetShouldExit($LastExitCode)
37+
Write-Host "Error when running Publish-Module:"
38+
Write-Host $_
39+
exit
40+
}
41+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# PSOpenAPITools.PSOpenAPITools\Api.AuthApi
2+
3+
All URIs are relative to *http://localhost:3000*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**Test-AuthHttpBasic**](AuthApi.md#Test-AuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
8+
9+
10+
<a id="Test-AuthHttpBasic"></a>
11+
# **Test-AuthHttpBasic**
12+
> String Test-AuthHttpBasic<br>
13+
14+
To test HTTP basic authentication
15+
16+
To test HTTP basic authentication
17+
18+
### Example
19+
```powershell
20+
# general setting of the PowerShell module, e.g. base URL, authentication, etc
21+
$Configuration = Get-Configuration
22+
# Configure HTTP basic authorization: http_auth
23+
$Configuration.Username = "YOUR_USERNAME"
24+
$Configuration.Password = "YOUR_PASSWORD"
25+
26+
27+
# To test HTTP basic authentication
28+
try {
29+
$Result = Test-AuthHttpBasic
30+
} catch {
31+
Write-Host ("Exception occurred when calling Test-AuthHttpBasic: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
32+
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
33+
}
34+
```
35+
36+
### Parameters
37+
This endpoint does not need any parameter.
38+
39+
### Return type
40+
41+
**String**
42+
43+
### Authorization
44+
45+
[http_auth](../README.md#http_auth)
46+
47+
### HTTP request headers
48+
49+
- **Content-Type**: Not defined
50+
- **Accept**: text/plain
51+
52+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
53+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Bird
2+
## Properties
3+
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**Size** | **String** | | [optional]
7+
**Color** | **String** | | [optional]
8+
9+
## Examples
10+
11+
- Prepare the resource
12+
```powershell
13+
$Bird = Initialize-PSOpenAPIToolsBird -Size null `
14+
-Color null
15+
```
16+
17+
- Convert the resource to JSON
18+
```powershell
19+
$Bird | ConvertTo-JSON
20+
```
21+
22+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
23+

0 commit comments

Comments
 (0)