update samples

This commit is contained in:
William Cheng
2025-09-21 17:29:03 +08:00
parent 260787b0a1
commit 117773f14c
30 changed files with 41 additions and 116 deletions

View File

@@ -31,7 +31,6 @@ paths:
$ref: '#/components/schemas/Foo'
/pet:
servers:
- url: 'http://domaincontrol.com/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
@@ -189,7 +188,6 @@ paths:
deprecated: true
'/pet/{petId}':
servers:
- url: 'http://domaincontrol.com/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
@@ -1360,7 +1358,6 @@ paths:
200:
description: OK
servers:
- url: 'http://domaincontrol.com/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
variables:
@@ -1383,7 +1380,7 @@ servers:
- 'v1'
- 'v2'
default: 'v2'
- url: https://domaincontrol.com/no_varaible
- 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -157,7 +157,7 @@ module Petstore
def initialize
@scheme = 'http'
@host = 'domaincontrol.com'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -290,10 +290,6 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -332,7 +328,7 @@ module Petstore
}
},
{
url: "https://domaincontrol.com/no_varaible",
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
@@ -355,10 +351,6 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -406,10 +398,6 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -457,10 +445,6 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -508,10 +492,6 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -559,10 +539,6 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://domaincontrol.com/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://domaincontrol.com/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -128,7 +128,7 @@ module Petstore
def initialize
@scheme = 'http'
@host = 'domaincontrol.com'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -254,10 +254,6 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -296,7 +292,7 @@ module Petstore
}
},
{
url: "https://domaincontrol.com/no_varaible",
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
@@ -319,10 +315,6 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -370,10 +362,6 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -421,10 +409,6 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -472,10 +456,6 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -523,10 +503,6 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://domaincontrol.com/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://domaincontrol.com/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -158,7 +158,7 @@ module Petstore
def initialize
@scheme = 'http'
@host = 'domaincontrol.com'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -286,10 +286,6 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -328,7 +324,7 @@ module Petstore
}
},
{
url: "https://domaincontrol.com/no_varaible",
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
@@ -351,10 +347,6 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -402,10 +394,6 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -453,10 +441,6 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -504,10 +488,6 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -555,10 +535,6 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://domaincontrol.com/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",

View File

@@ -27,31 +27,31 @@ describe Petstore::Configuration do
describe '#base_url' do
it 'should have the default value' do
expect(config.base_url).to eq("http://localhost/v2")
expect(config.base_url).to eq("http://petstore.swagger.io/v2")
end
it 'returns default value when invalid operation is passed' do
expect(config.base_url('invalid_operation')).to eq('http://localhost/v2')
expect(config.base_url('invalid_operation')).to eq('http://petstore.swagger.io/v2')
end
it 'returns proper URL default server_index' do
expect(config.base_url(:'PetApi.add_pet')).to eq('http://localhost/v2')
expect(config.base_url(:'PetApi.add_pet')).to eq('http://petstore.swagger.io/v2')
end
it 'returns proper URL when server_index is set' do
config.server_index = 2
config.server_index = 1
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
end
it 'returns proper URL when server_operation_index is set' do
config.server_operation_index = {
:'PetApi.add_pet' =>2
:'PetApi.add_pet' => 1
}
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
end
it 'returns proper URL from server_settings when server_index is set' do
config.server_index = 2
config.server_index = 1
expect(config.base_url).to eq('https://localhost:8080/v2')
end
@@ -66,11 +66,11 @@ describe Petstore::Configuration do
it 'throws argument error when attempting to use a server index that is out of bounds' do
config.server_operation_index = {
:'PetApi.add_pet' => 11
:'PetApi.add_pet' => 10
}
expect {
config.base_url(:'PetApi.add_pet')
}.to raise_error(ArgumentError, 'Invalid index 11 when selecting the server. Must not be nil and must be less than 4')
}.to raise_error(ArgumentError, 'Invalid index 10 when selecting the server. Must not be nil and must be less than 4')
end
it 'should remove trailing slashes' do

View File

@@ -66,7 +66,7 @@ describe "Pet" do
expect(index_backup).to eq({})
# test operation index 1 (invalid path)
@pet_api.api_client.config.server_operation_index = {
:'PetApi.get_pet_by_id' => 2
:'PetApi.get_pet_by_id' => 1
}
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path-server-test.petstore.local/v2')
@@ -86,7 +86,7 @@ describe "Pet" do
expect(index_backup).to eq({})
# test operation index 3
@pet_api.api_client.config.server_operation_index = {
:'PetApi.get_pet_by_id' => 4
:'PetApi.get_pet_by_id' => 3
}
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path.v2.test.openapi-generator.tech/v2')