From fb1706bd2bd1202c799bffa6eb20bd53c68ebfe1 Mon Sep 17 00:00:00 2001 From: Cubid <37664014+Cubid@users.noreply.github.com> Date: Thu, 26 May 2022 18:54:04 +0200 Subject: [PATCH] [php-symfony] Allow non mandatory array value (#11618) Co-authored-by: David CLEMENT --- .../php-symfony/serialization/JmsSerializer.mustache | 5 +++++ .../php-symfony/SymfonyBundle-php/Service/JmsSerializer.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache b/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache index dc352aedc81e..0a6571e2bde6 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache @@ -95,6 +95,11 @@ class JmsSerializer implements SerializerInterface private function deserializeArrayString($format, $type, $data) { + if($data === null) + { + return []; + } + // Parse the string using the correct separator switch ($format) { case 'csv': diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php index 0ef6b708e9d7..8d301b5bba4d 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php @@ -95,6 +95,11 @@ class JmsSerializer implements SerializerInterface private function deserializeArrayString($format, $type, $data) { + if($data === null) + { + return []; + } + // Parse the string using the correct separator switch ($format) { case 'csv':