Description
PHP Base API classes call setPath() on the ApiServer by default. Here's a sample generated constructor:
public function __construct(\SwaggerUserService\ApiClient $apiClient = null)
{
if ($apiClient == null) {
$apiClient = new ApiClient();
$apiClient->getConfig()->setHost('http://localhost/v1');
}
$this->apiClient = $apiClient;
}
Calling setHost() is unnecessary because ApiClient() constructor configures itself based on the default. A related issue is that the code assumes (and hardcodes) localhost as the host when one isn't provided.
This combination makes wrapping the Swagger-generated client in our host-discovery code unnecessarily complex.
Swagger-codegen version
Unsure what version is being used, not sure where to find that. I installed codegen through Homebrew. Looking at the code in master, though, this appears to be an issue there as well.
Swagger declaration file content or url
https://gist.github.com/toomuchpete/38ad55e570e103954d404c5df73c0e00
Command line used for generation
swagger-codegen generate -l php -i swagger.yaml
Steps to reproduce
Related issues
None found.
Suggest a Fix
Remove this line:
|
$apiClient->getConfig()->setHost('{{basePath}}'); |
Description
PHP Base API classes call
setPath()on the ApiServer by default. Here's a sample generated constructor:Calling
setHost()is unnecessary because ApiClient() constructor configures itself based on the default. A related issue is that the code assumes (and hardcodes)localhostas the host when one isn't provided.This combination makes wrapping the Swagger-generated client in our host-discovery code unnecessarily complex.
Swagger-codegen version
Unsure what version is being used, not sure where to find that. I installed codegen through Homebrew. Looking at the code in master, though, this appears to be an issue there as well.
Swagger declaration file content or url
https://gist.github.com/toomuchpete/38ad55e570e103954d404c5df73c0e00
Command line used for generation
Steps to reproduce
Related issues
None found.
Suggest a Fix
Remove this line:
swagger-codegen/modules/swagger-codegen/src/main/resources/php/api.mustache
Line 52 in 1ea9865