William Cheng a7e92786df
[PowerShell] add more tests to powershell client (#12057)
* add more tests to powershell client

* update spec

* update method name

* add new file
2022-04-06 10:24:32 +08:00

77 lines
2.3 KiB
PowerShell

#
# OpenAPI Petstore
# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
function Get-FunctionsToExport {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[ValidateNotNullOrEmpty()]
[Alias('FullName')]
$Path
)
Process {
$Token = $null
$ParserErr = $null
$Ast = [System.Management.Automation.Language.Parser]::ParseFile(
$Path,
[ref]$Token,
[ref]$ParserErr
)
if ($ParserErr) {
throw $ParserErr
} else {
foreach ($name in 'Begin', 'Process', 'End') {
foreach ($Statement in $Ast."${name}Block".Statements) {
if (
[String]::IsNullOrWhiteSpace($Statement.Name) -or
$Statement.Extent.ToString() -notmatch
('function\W+{0}' -f $Statement.Name)
) {
continue
}
$Statement.Name
}
}
}
}
}
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$FunctionPath = 'Api', 'Model', 'Client' | ForEach-Object {Join-Path "$ScriptDir\src\PSPetstore\" $_}
$Manifest = @{
Path = "$ScriptDir\src\PSPetstore\PSPetstore.psd1"
Author = 'OpenAPI Generator Team'
CompanyName = 'openapitools.org'
Description = 'PSPetstore - the PowerShell module for OpenAPI Petstore'
Tags = @('PetStore' ,'powershell' ,'sdk' )
ProjectUri = 'https://github.com/OpenAPITools/openapi-generator'
LicenseUri = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
ReleaseNotes = 'This is a sample project'
ModuleVersion = '0.1.2'
RootModule = 'PSPetstore.psm1'
Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module
PowerShellVersion = '5.0'
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
VariablesToExport = @()
AliasesToExport = @()
CmdletsToExport = @()
}
New-ModuleManifest @Manifest