Skip to content

Commit

Permalink
fixed mixed format serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed Oct 19, 2024
1 parent b52caaf commit dd078f0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Support/Generator/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,21 @@ private function setType(Type $type)

public function toArray()
{
return array_merge($this->type->toArray(), array_filter([
$typeArray = $this->type->toArray();

if ($typeArray instanceof \stdClass) { // mixed
$typeArray = [];
}

$result = array_merge($typeArray, array_filter([
'title' => $this->title,
]));

if (empty($result)) {
return (object) [];
}

return $result;
}

public static function createFromParameters(array $parameters)
Expand Down

0 comments on commit dd078f0

Please sign in to comment.