Skip to content

Commit 89c5c86

Browse files
Work around where empty lists are missing from responses (#1621)
1 parent d0aa3b9 commit 89c5c86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Generator/ResponseParser/RestJsonParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private function parseResponseList(ListShape $shape, string $input, bool $requir
336336
return strtr($required ? '$this->FUNCTION_NAME(INPUT)' : 'EMPTY_METHOD(INPUT) ? EMPTY : $this->FUNCTION_NAME(INPUT)', [
337337
'EMPTY_METHOD' => $inObject ? '!isset' : 'empty',
338338
'EMPTY' => !$inObject ? '[]' : 'null',
339-
'INPUT' => $input,
339+
'INPUT' => $required && !$inObject ? "$input ?? []" : $input,
340340
'FUNCTION_NAME' => $functionName,
341341
]);
342342
}

0 commit comments

Comments
 (0)