mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-15 17:03:43 +00:00
Add workflow for PowerShell clients (#21979)
* add workflow for powershell client * update * fix container * import, test * combine * use localhost * update tests * remove powershell tests from appveyor.yml
This commit is contained in:
parent
46de9c8c16
commit
45e4fa1633
40
.github/workflows/samples-powershell.yaml
vendored
Normal file
40
.github/workflows/samples-powershell.yaml
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: Samples PowerShell
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- samples/client/petstore/powershell/**
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- samples/client/petstore/powershell/**
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test Powershell Clients
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
sample:
|
||||||
|
- samples/client/petstore/powershell/
|
||||||
|
services:
|
||||||
|
petstore-api:
|
||||||
|
image: swaggerapi/petstore
|
||||||
|
ports:
|
||||||
|
- 80:8080
|
||||||
|
env:
|
||||||
|
SWAGGER_HOST: http://petstore.swagger.io
|
||||||
|
SWAGGER_BASE_PATH: /v2
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- name: Build the client
|
||||||
|
working-directory: ${{ matrix.sample }}
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
./Build.ps1
|
||||||
|
- name: Test
|
||||||
|
working-directory: ${{ matrix.sample }}
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
Import-Module -Name './src/PSPetstore'
|
||||||
|
Invoke-Pester -PassThru
|
||||||
|
|
||||||
|
|
@ -13,7 +13,6 @@ install:
|
|||||||
- cmd: docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
- cmd: docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||||
- ps: Start-Sleep -s 120
|
- ps: Start-Sleep -s 120
|
||||||
- ps: $PSVersionTable.PSVersion
|
- ps: $PSVersionTable.PSVersion
|
||||||
- ps: Install-Module -Name Pester -Force -Scope CurrentUser -SkipPublisherCheck
|
|
||||||
build_script:
|
build_script:
|
||||||
- dotnet --info
|
- dotnet --info
|
||||||
# build C# aspnetcore 5.0 server
|
# build C# aspnetcore 5.0 server
|
||||||
@ -108,11 +107,6 @@ test_script:
|
|||||||
# - .\bin\windows\run-all-petstore.cmd
|
# - .\bin\windows\run-all-petstore.cmd
|
||||||
# generate all petstore clients (openapi3)
|
# generate all petstore clients (openapi3)
|
||||||
# - .\bin\openapi3\windows\run-all-petstore.cmd
|
# - .\bin\openapi3\windows\run-all-petstore.cmd
|
||||||
|
|
||||||
# test ps petstore
|
|
||||||
- ps: |
|
|
||||||
cd samples\client\petstore\powershell\
|
|
||||||
.\CIRunTest.ps1
|
|
||||||
cache:
|
cache:
|
||||||
- C:\maven\
|
- C:\maven\
|
||||||
- C:\gradle\
|
- C:\gradle\
|
||||||
|
@ -31,6 +31,7 @@ paths:
|
|||||||
$ref: '#/components/schemas/Foo'
|
$ref: '#/components/schemas/Foo'
|
||||||
/pet:
|
/pet:
|
||||||
servers:
|
servers:
|
||||||
|
- url: 'http://localhost/v2'
|
||||||
- url: 'http://petstore.swagger.io/v2'
|
- url: 'http://petstore.swagger.io/v2'
|
||||||
- url: 'http://path-server-test.petstore.local/v2'
|
- url: 'http://path-server-test.petstore.local/v2'
|
||||||
post:
|
post:
|
||||||
@ -1170,6 +1171,7 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ArrayOfEnums'
|
$ref: '#/components/schemas/ArrayOfEnums'
|
||||||
servers:
|
servers:
|
||||||
|
- url: 'http://localhost/v2'
|
||||||
- url: 'http://{server}.swagger.io:{port}/v2'
|
- url: 'http://{server}.swagger.io:{port}/v2'
|
||||||
description: petstore server
|
description: petstore server
|
||||||
variables:
|
variables:
|
||||||
|
@ -21,3 +21,6 @@
|
|||||||
#docs/*.md
|
#docs/*.md
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
#!docs/README.md
|
#!docs/README.md
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
@ -52,7 +52,7 @@ For troubleshooting, please run `$DebugPreference = 'Continue'` to turn on debug
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSAnotherFakeApi
|
# PSPetstore.PSPetstore\Api.PSAnotherFakeApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSDefaultApi
|
# PSPetstore.PSPetstore\Api.PSDefaultApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSFakeApi
|
# PSPetstore.PSPetstore\Api.PSFakeApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSFakeClassnameTags123Api
|
# PSPetstore.PSPetstore\Api.PSFakeClassnameTags123Api
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSPetApi
|
# PSPetstore.PSPetstore\Api.PSPetApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSStoreApi
|
# PSPetstore.PSPetstore\Api.PSStoreApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# PSPetstore.PSPetstore\Api.PSUserApi
|
# PSPetstore.PSPetstore\Api.PSUserApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
All URIs are relative to *http://localhost/v2*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
|
@ -23,7 +23,7 @@ function Get-PSConfiguration {
|
|||||||
$Configuration = $Script:Configuration
|
$Configuration = $Script:Configuration
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($Configuration["BaseUrl"])) {
|
if ([string]::IsNullOrEmpty($Configuration["BaseUrl"])) {
|
||||||
$Configuration["BaseUrl"] = "http://petstore.swagger.io:80/v2";
|
$Configuration["BaseUrl"] = "http://localhost/v2";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$Configuration.containsKey("Username")) {
|
if (!$Configuration.containsKey("Username")) {
|
||||||
@ -311,6 +311,10 @@ System.Collections.Hashtable[]
|
|||||||
#>
|
#>
|
||||||
function Get-PSHostSetting {
|
function Get-PSHostSetting {
|
||||||
return ,@(
|
return ,@(
|
||||||
|
@{
|
||||||
|
"Url" = "http://localhost/v2";
|
||||||
|
"Description" = "No description provided";
|
||||||
|
},
|
||||||
@{
|
@{
|
||||||
"Url" = "http://{server}.swagger.io:{port}/v2";
|
"Url" = "http://{server}.swagger.io:{port}/v2";
|
||||||
"Description" = "petstore server";
|
"Description" = "petstore server";
|
||||||
|
@ -140,19 +140,19 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' {
|
|||||||
|
|
||||||
$HS = Get-PSHostSetting
|
$HS = Get-PSHostSetting
|
||||||
|
|
||||||
$HS[0]["Url"] | Should -Be "http://{server}.swagger.io:{port}/v2"
|
$HS[1]["Url"] | Should -Be "http://{server}.swagger.io:{port}/v2"
|
||||||
$HS[0]["Description"] | Should -Be "petstore server"
|
$HS[1]["Description"] | Should -Be "petstore server"
|
||||||
$HS[0]["Variables"]["server"]["Description"] | Should -Be "No description provided"
|
$HS[1]["Variables"]["server"]["Description"] | Should -Be "No description provided"
|
||||||
$HS[0]["Variables"]["server"]["DefaultValue"] | Should -Be "petstore"
|
$HS[1]["Variables"]["server"]["DefaultValue"] | Should -Be "petstore"
|
||||||
$HS[0]["Variables"]["server"]["EnumValues"] | Should -Be @("petstore",
|
$HS[1]["Variables"]["server"]["EnumValues"] | Should -Be @("petstore",
|
||||||
"qa-petstore",
|
"qa-petstore",
|
||||||
"dev-petstore")
|
"dev-petstore")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Get-PSUrlFromHostSetting tests" {
|
It "Get-PSUrlFromHostSetting tests" {
|
||||||
Get-PSUrlFromHostSetting -Index 0 | Should -Be "http://petstore.swagger.io:80/v2"
|
Get-PSUrlFromHostSetting -Index 1 | Should -Be "http://petstore.swagger.io:80/v2"
|
||||||
Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "8080" } | Should -Be "http://petstore.swagger.io:8080/v2"
|
Get-PSUrlFromHostSetting -Index 1 -Variables @{ "port" = "8080" } | Should -Be "http://petstore.swagger.io:8080/v2"
|
||||||
#Get-PSUrlFromHostSetting -Index 2 | Should -Throw -ExceptionType ([RuntimeException])
|
#Get-PSUrlFromHostSetting -Index 2 | Should -Throw -ExceptionType ([RuntimeException])
|
||||||
#Get-PSUrlFromHostSetting -Index 2 -ErrorAction Stop | Should -Throw "RuntimeException: Invalid index 2 when selecting the host. Must -Be less than 2"
|
#Get-PSUrlFromHostSetting -Index 2 -ErrorAction Stop | Should -Throw "RuntimeException: Invalid index 2 when selecting the host. Must -Be less than 2"
|
||||||
#Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "1234" } -ErrorAction Stop | Should -Throw "RuntimeException: The variable 'port' in the host URL has invalid value 1234. Must -Be 80,8080"
|
#Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "1234" } -ErrorAction Stop | Should -Throw "RuntimeException: The variable 'port' in the host URL has invalid value 1234. Must -Be 80,8080"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user