mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 01:16:11 +00:00
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
This commit is contained in:
@@ -1135,6 +1135,8 @@ servers:
|
|||||||
- 'v1'
|
- 'v1'
|
||||||
- 'v2'
|
- 'v2'
|
||||||
default: 'v2'
|
default: 'v2'
|
||||||
|
- url: https://127.0.0.1/no_variable
|
||||||
|
description: The local server without variables
|
||||||
components:
|
components:
|
||||||
requestBodies:
|
requestBodies:
|
||||||
UserArray:
|
UserArray:
|
||||||
|
|||||||
@@ -1120,6 +1120,8 @@ servers:
|
|||||||
- 'v1'
|
- 'v1'
|
||||||
- 'v2'
|
- 'v2'
|
||||||
default: 'v2'
|
default: 'v2'
|
||||||
|
- url: https://127.0.0.1/no_variable
|
||||||
|
description: The local server without variables
|
||||||
components:
|
components:
|
||||||
requestBodies:
|
requestBodies:
|
||||||
UserArray:
|
UserArray:
|
||||||
|
|||||||
@@ -1142,6 +1142,8 @@ servers:
|
|||||||
- 'v1'
|
- 'v1'
|
||||||
- 'v2'
|
- 'v2'
|
||||||
default: 'v2'
|
default: 'v2'
|
||||||
|
- url: https://127.0.0.1/no_varaible
|
||||||
|
description: The local server without variables
|
||||||
components:
|
components:
|
||||||
requestBodies:
|
requestBodies:
|
||||||
UserArray:
|
UserArray:
|
||||||
|
|||||||
@@ -167,6 +167,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{"url", "https://127.0.0.1/no_variable"},
|
||||||
|
{"description", "The local server without variables"},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{"url", "https://127.0.0.1/no_variable"},
|
||||||
|
{"description", "The local server without variables"},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -615,6 +615,10 @@ class ApiClient {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': "https://127.0.0.1/no_varaible",
|
||||||
|
'description': "The local server without variables",
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -616,6 +616,10 @@ class ApiClient {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': "https://127.0.0.1/no_varaible",
|
||||||
|
'description': "The local server without variables",
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,6 +474,10 @@ class Configuration
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"url" => "https://127.0.0.1/no_varaible",
|
||||||
|
"description" => "The local server without variables",
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ConfigurationTest extends TestCase
|
|||||||
$config = new Configuration();
|
$config = new Configuration();
|
||||||
$servers = $config->getHostSettings();
|
$servers = $config->getHostSettings();
|
||||||
|
|
||||||
$this->assertCount(2, $servers);
|
$this->assertCount(3, $servers);
|
||||||
$this->assertSame("http://{server}.swagger.io:{port}/v2", $servers[0]["url"]);
|
$this->assertSame("http://{server}.swagger.io:{port}/v2", $servers[0]["url"]);
|
||||||
$this->assertSame("petstore", $servers[0]["variables"]["server"]["default_value"]);
|
$this->assertSame("petstore", $servers[0]["variables"]["server"]["default_value"]);
|
||||||
$this->assertSame("80", $servers[0]["variables"]["port"]["default_value"]);
|
$this->assertSame("80", $servers[0]["variables"]["port"]["default_value"]);
|
||||||
@@ -47,13 +47,13 @@ class ConfigurationTest extends TestCase
|
|||||||
public function testInvalidIndex()
|
public function testInvalidIndex()
|
||||||
{
|
{
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessage('Invalid index 2 when selecting the host. Must be less than 2');
|
$this->expectExceptionMessage('Invalid index 3 when selecting the host. Must be less than 3');
|
||||||
$config = new Configuration();
|
$config = new Configuration();
|
||||||
$url = $config->getHostFromSettings(2);
|
$url = $config->getHostFromSettings(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test host settings with invalid vaues
|
* Test host settings with invalid values
|
||||||
*/
|
*/
|
||||||
public function testHostUrlWithInvalidValues()
|
public function testHostUrlWithInvalidValues()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -286,6 +286,10 @@ module Petstore
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: "https://127.0.0.1/no_varaible",
|
||||||
|
description: "The local server without variables",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -291,6 +291,10 @@ module Petstore
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: "https://127.0.0.1/no_varaible",
|
||||||
|
description: "The local server without variables",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ servers:
|
|||||||
enum:
|
enum:
|
||||||
- v1
|
- v1
|
||||||
- v2
|
- v2
|
||||||
|
- description: The local server without variables
|
||||||
|
url: https://127.0.0.1/no_variable
|
||||||
tags:
|
tags:
|
||||||
- description: Everything about your Pets
|
- description: Everything about your Pets
|
||||||
name: pet
|
name: pet
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ func NewConfiguration() *Configuration {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
URL: "https://127.0.0.1/no_variable",
|
||||||
|
Description: "The local server without variables",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
OperationServers: map[string]ServerConfigurations{
|
OperationServers: map[string]ServerConfigurations{
|
||||||
"PetApiService.AddPet": {
|
"PetApiService.AddPet": {
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ servers:
|
|||||||
enum:
|
enum:
|
||||||
- v1
|
- v1
|
||||||
- v2
|
- v2
|
||||||
|
- description: The local server without variables
|
||||||
|
url: https://127.0.0.1/no_variable
|
||||||
tags:
|
tags:
|
||||||
- description: Everything about your Pets
|
- description: Everything about your Pets
|
||||||
name: pet
|
name: pet
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
}}
|
}}
|
||||||
|
),
|
||||||
|
new ServerConfiguration(
|
||||||
|
"https://127.0.0.1/no_variable",
|
||||||
|
"The local server without variables",
|
||||||
|
new HashMap<String, ServerVariable>()
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
protected Integer serverIndex = 0;
|
protected Integer serverIndex = 0;
|
||||||
|
|||||||
@@ -556,6 +556,10 @@ conf = petstore_api.Configuration(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': "https://127.0.0.1/no_varaible",
|
||||||
|
'description': "The local server without variables",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user