forked from loafle/openapi-generator-original
Fix bug when variables key doesn't exist (#7429)
This commit is contained in:
parent
80bef2f79a
commit
5675d5fe61
@ -482,7 +482,7 @@ class Configuration
|
|||||||
$url = $host["url"];
|
$url = $host["url"];
|
||||||
|
|
||||||
// go through variable and assign a value
|
// go through variable and assign a value
|
||||||
foreach ($host["variables"] as $name => $variable) {
|
foreach ($host["variables"] ?? [] as $name => $variable) {
|
||||||
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
|
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
|
||||||
if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
|
if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
|
||||||
$url = str_replace("{".$name."}", $variables[$name], $url);
|
$url = str_replace("{".$name."}", $variables[$name], $url);
|
||||||
|
@ -499,7 +499,7 @@ class Configuration
|
|||||||
$url = $host["url"];
|
$url = $host["url"];
|
||||||
|
|
||||||
// go through variable and assign a value
|
// go through variable and assign a value
|
||||||
foreach ($host["variables"] as $name => $variable) {
|
foreach ($host["variables"] ?? [] as $name => $variable) {
|
||||||
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
|
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
|
||||||
if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
|
if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
|
||||||
$url = str_replace("{".$name."}", $variables[$name], $url);
|
$url = str_replace("{".$name."}", $variables[$name], $url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user