From 36548b9cbf99fb4fc769b2e213731fd815a0a1ef Mon Sep 17 00:00:00 2001 From: Apoorv Verma Date: Thu, 13 Oct 2022 10:54:35 +0530 Subject: [PATCH 1/2] Add Guzzle Request Options for felxibility --- .../main/resources/php/Configuration.mustache | 28 +++++++++++++++++++ .../src/main/resources/php/api.mustache | 4 +++ 2 files changed, 32 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/php/Configuration.mustache b/modules/swagger-codegen/src/main/resources/php/Configuration.mustache index cdbba93a000..1fdccf7006a 100644 --- a/modules/swagger-codegen/src/main/resources/php/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/php/Configuration.mustache @@ -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) * @@ -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) * diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index e0b01e1f678..800ed7fa2ec 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -523,6 +523,10 @@ use {{invokerPackage}}\ObjectSerializer; } } + if(!empty($this->config->getRequestOptions())) { + $options = array_merge($options, $this->config->getRequestOptions()); + } + return $options; } } From 3808aae70d2862e5f85d3c075f0249e8ff20eba4 Mon Sep 17 00:00:00 2001 From: Apoorv Verma Date: Thu, 1 Dec 2022 11:22:34 +0000 Subject: [PATCH 2/2] Fix for non parent Invalid properties --- .../src/main/resources/php/model_generic.mustache | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache index 867d3b5a13d..5cfc00d9d4e 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache @@ -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}}