Compare commits

...

18 Commits

Author SHA1 Message Date
William Cheng
3d25263e32 use localhost 2025-09-27 16:33:24 +08:00
William Cheng
9a2d997398 skip host table update 2025-09-27 16:19:59 +08:00
William Cheng
d920f72020 test with ruby 3.4 2025-09-27 16:17:40 +08:00
William Cheng
152c87ee18 Revert "test with mac"
This reverts commit 3acc76a48b.
2025-09-27 15:53:48 +08:00
William Cheng
3acc76a48b test with mac 2025-09-27 15:32:08 +08:00
William Cheng
efd2fe60ad Merge remote-tracking branch 'origin/master' into ruby-github-test 2025-09-24 16:24:15 +08:00
William Cheng
43c78856f5 add new files 2025-09-21 17:51:01 +08:00
William Cheng
564f4e023d cat hosts 2025-09-21 17:34:07 +08:00
William Cheng
117773f14c update samples 2025-09-21 17:29:03 +08:00
William Cheng
260787b0a1 update 2025-09-21 17:07:40 +08:00
William Cheng
ef0aef28d7 use 127.0.0.1 2025-09-21 17:02:14 +08:00
William Cheng
324d773123 update tests 2025-09-21 16:56:52 +08:00
William Cheng
2760903274 update config to use ruby petstore fake spec 2025-09-21 16:48:43 +08:00
William Cheng
9d29eb98bc localhost 2025-09-21 16:44:59 +08:00
William Cheng
c2a8e11b45 add petstore, update host table 2025-09-21 16:39:50 +08:00
William Cheng
2b3947ea1a fix workflow 2025-09-21 16:38:06 +08:00
William Cheng
33fdad9554 add echo client tests 2025-09-21 16:35:55 +08:00
William Cheng
dceb03a8f0 migrate ruby tests to github workflow 2025-09-21 16:33:18 +08:00
31 changed files with 181 additions and 63 deletions

View File

@@ -0,0 +1,43 @@
name: Samples Ruby
on:
push:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
pull_request:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
jobs:
build:
name: Build Ruby
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/ruby-httpx/'
- 'samples/client/echo_api/ruby-faraday/'
- 'samples/client/echo_api/ruby-typhoeus/'
steps:
- uses: actions/checkout@v5
- name: Setup node.js
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install
- name: Run rspec
working-directory: ${{ matrix.sample }}
run: rspec

View File

@@ -1,16 +1,18 @@
name: Samples Ruby
name: Samples Ruby
on:
push:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
pull_request:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
jobs:
build:
@@ -20,21 +22,28 @@ jobs:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/ruby-httpx/'
- 'samples/client/echo_api/ruby-faraday/'
- 'samples/client/echo_api/ruby-typhoeus/'
- samples/client/petstore/ruby/
#- samples/client/petstore/ruby-faraday/
#- samples/client/petstore/ruby-httpx/
#- samples/client/petstore/ruby-autoload/
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: Setup node.js
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- uses: actions/setup-ruby@v1
#- name: Add hosts to /etc/hosts
# run: |
# sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
# cat /etc/hosts
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
ruby-version: '3.4' # Not needed with a .ruby-version, .tool-versions or mise.toml
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install

View File

@@ -31,6 +31,7 @@ paths:
$ref: '#/components/schemas/Foo'
/pet:
servers:
- url: 'http://127.0.0.1/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
@@ -188,6 +189,7 @@ paths:
deprecated: true
'/pet/{petId}':
servers:
- url: 'http://127.0.0.1/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
@@ -1358,6 +1360,8 @@ paths:
200:
description: OK
servers:
- url: https://127.0.0.1/v2
description: The local server without variables
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
variables:
@@ -1380,8 +1384,6 @@ servers:
- 'v1'
- 'v2'
default: 'v2'
- url: https://127.0.0.1/no_varaible
description: The local server without variables
- url: http://server.{version}.openapi-generator.tech
description: The openapi-generator test server
variables:

View File

@@ -72,7 +72,7 @@ end
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@@ -1,6 +1,6 @@
# Petstore::AnotherFakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::DefaultApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeClassnameTags123Api
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::PetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::StoreApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::UserApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -156,8 +156,8 @@ module Petstore
attr_accessor :force_ending_format
def initialize
@scheme = 'http'
@host = 'petstore.swagger.io'
@scheme = 'https'
@host = '127.0.0.1'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -290,6 +290,10 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "https://127.0.0.1/v2",
description: "The local server without variables",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -327,10 +331,6 @@ module Petstore
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
url: "http://server.{version}.openapi-generator.tech",
description: "The openapi-generator test server",
@@ -351,6 +351,10 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -398,6 +402,10 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -445,6 +453,10 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -492,6 +504,10 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -539,6 +555,10 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",

View File

@@ -72,7 +72,7 @@ end
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@@ -1,6 +1,6 @@
# Petstore::AnotherFakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::DefaultApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeClassnameTags123Api
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::PetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::StoreApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::UserApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -127,8 +127,8 @@ module Petstore
attr_accessor :force_ending_format
def initialize
@scheme = 'http'
@host = 'petstore.swagger.io'
@scheme = 'https'
@host = '127.0.0.1'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -254,6 +254,10 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "https://127.0.0.1/v2",
description: "The local server without variables",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -291,10 +295,6 @@ module Petstore
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
url: "http://server.{version}.openapi-generator.tech",
description: "The openapi-generator test server",
@@ -315,6 +315,10 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -362,6 +366,10 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -409,6 +417,10 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -456,6 +468,10 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -503,6 +519,10 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",

View File

@@ -21,3 +21,7 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
#
#
#
#

View File

@@ -72,7 +72,7 @@ end
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@@ -1,6 +1,6 @@
# Petstore::AnotherFakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::DefaultApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeClassnameTags123Api
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::PetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::StoreApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::UserApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *https://127.0.0.1/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -157,8 +157,8 @@ module Petstore
attr_accessor :force_ending_format
def initialize
@scheme = 'http'
@host = 'petstore.swagger.io'
@scheme = 'https'
@host = '127.0.0.1'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -286,6 +286,10 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "https://127.0.0.1/v2",
description: "The local server without variables",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -323,10 +327,6 @@ module Petstore
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
url: "http://server.{version}.openapi-generator.tech",
description: "The openapi-generator test server",
@@ -347,6 +347,10 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -394,6 +398,10 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -441,6 +449,10 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -488,6 +500,10 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -535,6 +551,10 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",