Skip to content

Commit d7dfcc2

Browse files
authored
Add server URL without variables to the test spec (#7517)
* add server url without variables to the test spec * fix php tests * fix tests * fix assertion
1 parent 785cbbb commit d7dfcc2

16 files changed

Lines changed: 59 additions & 4 deletions

File tree

modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,8 @@ servers:
11351135
- 'v1'
11361136
- 'v2'
11371137
default: 'v2'
1138+
- url: https://127.0.0.1/no_variable
1139+
description: The local server without variables
11381140
components:
11391141
requestBodies:
11401142
UserArray:

modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,8 @@ servers:
11201120
- 'v1'
11211121
- 'v2'
11221122
default: 'v2'
1123+
- url: https://127.0.0.1/no_variable
1124+
description: The local server without variables
11231125
components:
11241126
requestBodies:
11251127
UserArray:

modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,8 @@ servers:
11421142
- 'v1'
11431143
- 'v2'
11441144
default: 'v2'
1145+
- url: https://127.0.0.1/no_varaible
1146+
description: The local server without variables
11451147
components:
11461148
requestBodies:
11471149
UserArray:

samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ public Configuration()
167167
}
168168
}
169169
}
170+
},
171+
{
172+
new Dictionary<string, object> {
173+
{"url", "https://127.0.0.1/no_variable"},
174+
{"description", "The local server without variables"},
175+
}
170176
}
171177
};
172178

samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ public Configuration()
172172
}
173173
}
174174
}
175+
},
176+
{
177+
new Dictionary<string, object> {
178+
{"url", "https://127.0.0.1/no_variable"},
179+
{"description", "The local server without variables"},
180+
}
175181
}
176182
};
177183

samples/client/petstore/javascript-es6/src/ApiClient.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,10 @@ class ApiClient {
615615
]
616616
}
617617
}
618+
},
619+
{
620+
'url': "https://127.0.0.1/no_varaible",
621+
'description': "The local server without variables",
618622
}
619623
];
620624
}

samples/client/petstore/javascript-promise-es6/src/ApiClient.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,10 @@ class ApiClient {
616616
]
617617
}
618618
}
619+
},
620+
{
621+
'url': "https://127.0.0.1/no_varaible",
622+
'description': "The local server without variables",
619623
}
620624
];
621625
}

samples/client/petstore/php/OpenAPIClient-php/lib/Configuration.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,10 @@ public function getHostSettings()
474474
]
475475
]
476476
]
477+
],
478+
[
479+
"url" => "https://127.0.0.1/no_varaible",
480+
"description" => "The local server without variables",
477481
]
478482
];
479483
}

samples/client/petstore/php/OpenAPIClient-php/tests/ConfigurationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function testMultipleServers()
1515
$config = new Configuration();
1616
$servers = $config->getHostSettings();
1717

18-
$this->assertCount(2, $servers);
18+
$this->assertCount(3, $servers);
1919
$this->assertSame("http://{server}.swagger.io:{port}/v2", $servers[0]["url"]);
2020
$this->assertSame("petstore", $servers[0]["variables"]["server"]["default_value"]);
2121
$this->assertSame("80", $servers[0]["variables"]["port"]["default_value"]);
@@ -47,13 +47,13 @@ public function testServerUrl()
4747
public function testInvalidIndex()
4848
{
4949
$this->expectException(\InvalidArgumentException::class);
50-
$this->expectExceptionMessage('Invalid index 2 when selecting the host. Must be less than 2');
50+
$this->expectExceptionMessage('Invalid index 3 when selecting the host. Must be less than 3');
5151
$config = new Configuration();
52-
$url = $config->getHostFromSettings(2);
52+
$url = $config->getHostFromSettings(3);
5353
}
5454

5555
/**
56-
* Test host settings with invalid vaues
56+
* Test host settings with invalid values
5757
*/
5858
public function testHostUrlWithInvalidValues()
5959
{

samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ def server_settings
286286
]
287287
}
288288
}
289+
},
290+
{
291+
url: "https://127.0.0.1/no_varaible",
292+
description: "The local server without variables",
289293
}
290294
]
291295
end

0 commit comments

Comments
 (0)