From 73a2d09b57a2828a8d978645901fbe282093322e Mon Sep 17 00:00:00 2001 From: Hannes Lau Date: Wed, 1 May 2024 14:54:14 +0200 Subject: [PATCH] feat(php-nextgen): allow to serialize collections of enums When serializing collections, make sure to serialize the members of the collection first, before applying http_build_query or implode. --- .../src/main/resources/php-nextgen/ObjectSerializer.mustache | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache index 5970d93dc958..b2d1cf65835b 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache @@ -358,6 +358,8 @@ class ObjectSerializer */ public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string { + $collection = array_map([self::class, 'sanitizeForSerialization'], $collection); + if ($allowCollectionFormatMulti && ('multi' === $style)) { // http_build_query() almost does the job for us. We just // need to fix the result of multidimensional arrays.