Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class Configuration
*/
protected $apiKeys = [];

/**
* Array to store Guzzle Request Options
*/
protected $requestConfigurations = [];

/**
* Associate array to store API prefix (e.g. Bearer)
*
Expand Down Expand Up @@ -135,6 +140,29 @@ class Configuration
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
}

/**
* Sets Additional Guzzle Request options
*
* @param array $additionalRequestConfigs Array of Addition Guzzle Configs
*
* @return $this
*/
public function setRequestOptions(array $additionalRequestConfigs)
{
$this->requestConfigurations = $additionalRequestConfigs;
return $this;
}

/**
* Gets Additional Guzzle Request options
*
* @return array of Guzzle Request options
*/
public function getRequestOptions()
{
return $this->requestConfigurations;
}

/**
* Sets the prefix for API key (e.g. Bearer)
*
Expand Down
4 changes: 4 additions & 0 deletions modules/swagger-codegen/src/main/resources/php/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ use {{invokerPackage}}\ObjectSerializer;
}
}

if(!empty($this->config->getRequestOptions())) {
$options = array_merge($options, $this->config->getRequestOptions());
}

return $options;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
*/
public function listInvalidProperties()
{
{{#parent}}
{{#parentSchema}}
$invalidProperties = parent::listInvalidProperties();
{{/parent}}
{{^parent}}
{{/parentSchema}}
{{^parentSchema}}
$invalidProperties = [];
{{/parent}}
{{/parentSchema}}

{{#vars}}
{{#required}}
Expand Down