From 485643b5cd3e95189cb439a0e1a06e5f4e7f1b9b Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 3 May 2021 14:23:15 +0200 Subject: [PATCH] Detect property schema from oneOf --- src/Generator/Schema.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Generator/Schema.php b/src/Generator/Schema.php index 8eb5d14..f741b87 100644 --- a/src/Generator/Schema.php +++ b/src/Generator/Schema.php @@ -97,6 +97,8 @@ public static function generate(string $name, string $namespace, string $classNa '', 'bool', ], $property->type)); + } else if (is_array($property->anyOf) && $property->anyOf[0] instanceof OpenAPiSchema && array_key_exists(spl_object_hash($property->anyOf[0]), $schemaClassNameMap)) { + $propertyStmt->setType('\\' . $namespace . '\\' . $schemaClassNameMap[spl_object_hash($property->anyOf[0])]); } if (count($docBlock) > 0) {