Skip to content

Commit 86ff873

Browse files
authored
[php][php-nextgen] fix array enum query parameters (#22320)
1 parent 28e2254 commit 86ff873

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
namespace {{invokerPackage}};
2121

22+
use BackedEnum;
2223
use DateTimeInterface;
2324
use DateTime;
2425
use GuzzleHttp\Psr7\Utils;
@@ -254,6 +255,11 @@ class ObjectSerializer
254255
// push key itself
255256
$result[] = $prop;
256257
}
258+
259+
if ($v instanceof BackedEnum) {
260+
$v = $v->value;
261+
}
262+
257263
$result[$prop] = $v;
258264
}
259265
}

samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
namespace OpenAPI\Client;
3030

31+
use BackedEnum;
3132
use DateTimeInterface;
3233
use DateTime;
3334
use GuzzleHttp\Psr7\Utils;
@@ -263,6 +264,11 @@ public static function toQueryValue(
263264
// push key itself
264265
$result[] = $prop;
265266
}
267+
268+
if ($v instanceof BackedEnum) {
269+
$v = $v->value;
270+
}
271+
266272
$result[$prop] = $v;
267273
}
268274
}

samples/client/echo_api/php-nextgen/src/ObjectSerializer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
namespace OpenAPI\Client;
3030

31+
use BackedEnum;
3132
use DateTimeInterface;
3233
use DateTime;
3334
use GuzzleHttp\Psr7\Utils;
@@ -263,6 +264,11 @@ public static function toQueryValue(
263264
// push key itself
264265
$result[] = $prop;
265266
}
267+
268+
if ($v instanceof BackedEnum) {
269+
$v = $v->value;
270+
}
271+
266272
$result[$prop] = $v;
267273
}
268274
}

samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
namespace OpenAPI\Client;
2929

30+
use BackedEnum;
3031
use DateTimeInterface;
3132
use DateTime;
3233
use GuzzleHttp\Psr7\Utils;
@@ -262,6 +263,11 @@ public static function toQueryValue(
262263
// push key itself
263264
$result[] = $prop;
264265
}
266+
267+
if ($v instanceof BackedEnum) {
268+
$v = $v->value;
269+
}
270+
265271
$result[$prop] = $v;
266272
}
267273
}

0 commit comments

Comments
 (0)