-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Milestone
Description
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.yamlSteps to reproduce
Related issues
None found.
Suggest a Fix
Remove this line:
| $apiClient->getConfig()->setHost('{{basePath}}'); |