From 3453c7ba1087d898a3d9c63ef732d3296ad58abb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 28 Jul 2025 18:33:52 +0800 Subject: [PATCH] Test PHP clients in Github workflow (#21643) * test php clients in github workflow * trigger build failure * update workflow * Revert "trigger build failure" This reverts commit 572a69f6bcbab426103c77de55c069bd74b5e7fb. * update tests * update tests * update test * fix tests * fix async test * update tests --- .github/workflows/samples-php-client.yaml | 45 +++++++++++++++++++ ...ith-fake-endpoints-models-for-testing.yaml | 1 + ...ith-fake-endpoints-models-for-testing.yaml | 1 + .../OpenAPIClient-php/docs/Api/PetApi.md | 6 ++- .../OpenAPIClient-php/src/Api/PetApi.php | 18 ++++++++ .../php/OpenAPIClient-php/docs/Api/PetApi.md | 6 ++- .../php/OpenAPIClient-php/lib/Api/PetApi.php | 18 ++++++++ .../php/OpenAPIClient-php/tests/AsyncTest.php | 3 +- .../php/OpenAPIClient-php/tests/DebugTest.php | 9 ++-- .../OpenAPIClient-php/tests/PetApiTest.php | 7 +-- .../tests/ServerVariablesInOperationTest.php | 8 ++-- .../petstore/php/psr-18/lib/Api/PetApi.php | 14 +++++- 12 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/samples-php-client.yaml diff --git a/.github/workflows/samples-php-client.yaml b/.github/workflows/samples-php-client.yaml new file mode 100644 index 00000000000..ded8bad29dc --- /dev/null +++ b/.github/workflows/samples-php-client.yaml @@ -0,0 +1,45 @@ +name: Samples PHP clients + +on: + push: + paths: + - samples/client/petstore/php/OpenAPIClient-php/** + pull_request: + paths: + - samples/client/petstore/php/OpenAPIClient-php/** +jobs: + build: + name: Build PHP projects + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - "8.1" + - "8.2" + - "8.3" + - "8.4" + sample: + # clients + - samples/client/petstore/php/OpenAPIClient-php/ + services: + petstore-api: + image: swaggerapi/petstore + ports: + - 80:8080 + env: + SWAGGER_HOST: http://petstore.swagger.io + SWAGGER_BASE_PATH: /v2 + steps: + - uses: actions/checkout@v4 + - name: Setup PHP with tools + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + tools: php-cs-fixer, phpunit + - name: composer install + working-directory: ${{ matrix.sample }} + run: composer install + - name: phpunit + working-directory: ${{ matrix.sample }} + run: vendor/bin/phpunit tests diff --git a/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml index 5ab53cee08b..bc56de575ad 100644 --- a/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml @@ -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' - url: 'http://{server}.swagger.io:{port}/v2' diff --git a/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml index c24a3993f61..eda138fdef9 100644 --- a/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml @@ -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' - url: 'http://{server}.swagger.io:{port}/v2' diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md index 7cc169e98bb..40edf90bfaa 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md @@ -21,7 +21,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati addPet($pet) ``` ### URI(s): -- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables +- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables - Variables: - server: target server - Allowed values: @@ -80,6 +80,7 @@ try { + ### Return type void (empty response body) @@ -346,7 +347,7 @@ try { updatePet($pet) ``` ### URI(s): -- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables +- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables - Variables: - server: target server - Allowed values: @@ -405,6 +406,7 @@ try { + ### Return type void (empty response body) diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php index 73d617d6290..af6503be584 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php @@ -158,6 +158,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -198,6 +199,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -269,6 +271,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -313,6 +316,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -373,6 +377,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -504,6 +509,10 @@ class PetApi protected function getHostSettingsForaddPet(): array { return [ + [ + "url" => "http://localhost/v2", + "description" => "No description provided", + ], [ "url" => "http://petstore.swagger.io/v2", "description" => "No description provided", @@ -1656,6 +1665,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1696,6 +1706,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1767,6 +1778,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1811,6 +1823,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1871,6 +1884,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -2002,6 +2016,10 @@ class PetApi protected function getHostSettingsForupdatePet(): array { return [ + [ + "url" => "http://localhost/v2", + "description" => "No description provided", + ], [ "url" => "http://petstore.swagger.io/v2", "description" => "No description provided", diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md index 7e0512051f1..1cef0c37d81 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md @@ -23,7 +23,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati addPet($pet) ``` ### URI(s): -- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables +- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables - Variables: - server: target server - Allowed values: @@ -82,6 +82,7 @@ try { + ### Return type void (empty response body) @@ -348,7 +349,7 @@ try { updatePet($pet) ``` ### URI(s): -- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables +- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables - Variables: - server: target server - Allowed values: @@ -407,6 +408,7 @@ try { + ### Return type void (empty response body) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 4b4e48c63f9..b856a824482 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -164,6 +164,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -199,6 +200,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -266,6 +268,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -305,6 +308,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -360,6 +364,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -486,6 +491,10 @@ class PetApi protected function getHostSettingsForaddPet(): array { return [ + [ + "url" => "http://localhost/v2", + "description" => "No description provided", + ], [ "url" => "http://petstore.swagger.io/v2", "description" => "No description provided", @@ -1583,6 +1592,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1618,6 +1628,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1685,6 +1696,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1724,6 +1736,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1779,6 +1792,7 @@ class PetApi * * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. * if needed, use the 'variables' parameter to pass variables to the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1905,6 +1919,10 @@ class PetApi protected function getHostSettingsForupdatePet(): array { return [ + [ + "url" => "http://localhost/v2", + "description" => "No description provided", + ], [ "url" => "http://petstore.swagger.io/v2", "description" => "No description provided", diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/AsyncTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/AsyncTest.php index 421eef565ce..50d71e6e9e3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/AsyncTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/AsyncTest.php @@ -16,7 +16,8 @@ class AsyncTest extends TestCase public function setUp(): void { - $this->api = new Api\PetApi(); + $config = (new Configuration())->setHost('http://localhost/v2'); + $this->api = new Api\PetApi(null, $config); $this->petId = 10005; $pet = new Model\Pet; diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php index b14dd018df0..050869768d8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php @@ -11,15 +11,16 @@ class DebugTest extends TestCase parent::setUpBeforeClass(); $newPet = new Model\Pet; $newPet->setId(1); - $newPet->setName("PHP Unit Test"); - (new Api\PetApi())->addPetWithHttpInfo($newPet); + $newPet->setName("PHP Unit Test"); + $config = (new Configuration())->setHost('http://localhost/v2'); + (new Api\PetApi(null, $config))->addPetWithHttpInfo($newPet); } public function testEnableDebugOutput() { $this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#'); - $config = new Configuration(); + $config = (new Configuration())->setHost('http://localhost/v2'); $config->setDebug(true); $api = new Api\PetApi(null, $config); $api->getPetById(1); @@ -29,7 +30,7 @@ class DebugTest extends TestCase { $this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#'); - $config = new Configuration(); + $config = (new Configuration())->setHost('http://localhost/v2'); $config->setDebug(true); $api = new Api\PetApi(null, $config); $promise = $api->getPetByIdAsync(1); diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php index bd1c2fb2a8a..eb32525895b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php @@ -41,15 +41,12 @@ class PetApiTest extends TestCase $newPet->setTags(array($tag)); $newPet->setCategory($category); - - $config = new Configuration(); - $petApi = new Api\PetApi(null, $config); - } public function setUp(): void { - $this->api = new Api\PetApi(); + $config = (new Configuration())->setHost('http://localhost/v2'); + $this->api = new Api\PetApi(null, $config); } public function testGetPetById() diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/ServerVariablesInOperationTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/ServerVariablesInOperationTest.php index 208ae7ed329..064ffe60f9e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/ServerVariablesInOperationTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/ServerVariablesInOperationTest.php @@ -30,10 +30,10 @@ class ServerVariablesInOperationTest extends TestCase $this->api->addPet($this->pet, 2); $request = $this->fakeHttpClient->getLastRequest(); - $this->assertEquals('petstore.swagger.io', $request->getUri()->getHost(), 'Server variable set to default value.'); + $this->assertEquals('path-server-test.petstore.local', $request->getUri()->getHost(), 'Server variable set to default value.'); # Test variables substitution - $this->api->addPet($this->pet, 2, [ 'server' => 'qa-petstore', 'port' => '8080']); + $this->api->addPet($this->pet, 3, [ 'server' => 'qa-petstore', 'port' => '8080']); $request = $this->fakeHttpClient->getLastRequest(); $this->assertEquals('qa-petstore.swagger.io', $request->getUri()->getHost(), 'Server set to "qa-petstore"'); @@ -43,7 +43,7 @@ class ServerVariablesInOperationTest extends TestCase public function testLegacyServerChoiceInOperation(): void { # Test legacy behavior (set server using api->setHostIndex() - $this->api->setHostIndex(1); + $this->api->setHostIndex(2); $this->api->addPet($this->pet); $request = $this->fakeHttpClient->getLastRequest(); @@ -53,6 +53,6 @@ class ServerVariablesInOperationTest extends TestCase public function testInvalidVariableValueInOperation(): void { $this->expectException(InvalidArgumentException::class); - $this->api->addPet($this->pet, 2,['server' => 'invalid-value']); + $this->api->addPet($this->pet, 3,['server' => 'invalid-value']); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php index a002591b50c..4148c86db0a 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php @@ -180,6 +180,7 @@ class PetApi * Add a new pet to the store * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -201,6 +202,7 @@ class PetApi * Add a new pet to the store * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -258,6 +260,7 @@ class PetApi * Add a new pet to the store * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -283,6 +286,7 @@ class PetApi * Add a new pet to the store * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -323,6 +327,7 @@ class PetApi * Create request for operation 'addPet' * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -405,7 +410,7 @@ class PetApi $headers ); - $operationHosts = ["http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"]; + $operationHosts = ["http://localhost/v2", "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"]; if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); } @@ -1432,6 +1437,7 @@ class PetApi * Update an existing pet * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1453,6 +1459,7 @@ class PetApi * Update an existing pet * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1510,6 +1517,7 @@ class PetApi * Update an existing pet * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1535,6 +1543,7 @@ class PetApi * Update an existing pet * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1575,6 +1584,7 @@ class PetApi * Create request for operation 'updatePet' * * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: http://localhost/v2 * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1657,7 +1667,7 @@ class PetApi $headers ); - $operationHosts = ["http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"]; + $operationHosts = ["http://localhost/v2", "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"]; if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); }