Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/samples-powershell.yaml
Original file line number Diff line number Diff line change
@@ -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


6 changes: 0 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- ps: Start-Sleep -s 120
- ps: $PSVersionTable.PSVersion
- ps: Install-Module -Name Pester -Force -Scope CurrentUser -SkipPublisherCheck
build_script:
- dotnet --info
# build C# aspnetcore 5.0 server
Expand Down Expand Up @@ -108,11 +107,6 @@ test_script:
# - .\bin\windows\run-all-petstore.cmd
# generate all petstore clients (openapi3)
# - .\bin\openapi3\windows\run-all-petstore.cmd

# test ps petstore
- ps: |
cd samples\client\petstore\powershell\
.\CIRunTest.ps1
cache:
- C:\maven\
- C:\gradle\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ paths:
$ref: '#/components/schemas/Foo'
/pet:
servers:
- url: 'http://localhost/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
post:
Expand Down Expand Up @@ -1170,6 +1171,7 @@ paths:
schema:
$ref: '#/components/schemas/ArrayOfEnums'
servers:
- url: 'http://localhost/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
variables:
Expand Down
3 changes: 3 additions & 0 deletions samples/client/petstore/powershell/.openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
#
#
#
2 changes: 1 addition & 1 deletion samples/client/petstore/powershell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ For troubleshooting, please run `$DebugPreference = 'Continue'` to turn on debug

## 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
------------ | ------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/powershell/docs/PSDefaultApi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/powershell/docs/PSFakeApi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/powershell/docs/PSPetApi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/powershell/docs/PSStoreApi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/powershell/docs/PSUserApi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Get-PSConfiguration {
$Configuration = $Script:Configuration

if ([string]::IsNullOrEmpty($Configuration["BaseUrl"])) {
$Configuration["BaseUrl"] = "http://petstore.swagger.io:80/v2";
$Configuration["BaseUrl"] = "http://localhost/v2";
}

if (!$Configuration.containsKey("Username")) {
Expand Down Expand Up @@ -311,6 +311,10 @@ System.Collections.Hashtable[]
#>
function Get-PSHostSetting {
return ,@(
@{
"Url" = "http://localhost/v2";
"Description" = "No description provided";
},
@{
"Url" = "http://{server}.swagger.io:{port}/v2";
"Description" = "petstore server";
Expand Down
14 changes: 7 additions & 7 deletions samples/client/petstore/powershell/tests/Petstore.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,19 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' {

$HS = Get-PSHostSetting

$HS[0]["Url"] | Should -Be "http://{server}.swagger.io:{port}/v2"
$HS[0]["Description"] | Should -Be "petstore server"
$HS[0]["Variables"]["server"]["Description"] | Should -Be "No description provided"
$HS[0]["Variables"]["server"]["DefaultValue"] | Should -Be "petstore"
$HS[0]["Variables"]["server"]["EnumValues"] | Should -Be @("petstore",
$HS[1]["Url"] | Should -Be "http://{server}.swagger.io:{port}/v2"
$HS[1]["Description"] | Should -Be "petstore server"
$HS[1]["Variables"]["server"]["Description"] | Should -Be "No description provided"
$HS[1]["Variables"]["server"]["DefaultValue"] | Should -Be "petstore"
$HS[1]["Variables"]["server"]["EnumValues"] | Should -Be @("petstore",
"qa-petstore",
"dev-petstore")

}

It "Get-PSUrlFromHostSetting tests" {
Get-PSUrlFromHostSetting -Index 0 | 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 | Should -Be "http://petstore.swagger.io:80/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 -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"
Expand Down
Loading