diff --git a/PropertyDescriber/ObjectPropertyDescriber.php b/PropertyDescriber/ObjectPropertyDescriber.php index 58cea138e..b27d2cfd9 100644 --- a/PropertyDescriber/ObjectPropertyDescriber.php +++ b/PropertyDescriber/ObjectPropertyDescriber.php @@ -36,22 +36,13 @@ public function describe(array $types, OA\Schema $property, array $groups = null $types[0]->getCollectionValueType() ); // ignore nullable field -// if ($types[0]->isNullable()) { -// $weakContext = Util::createWeakContext($property->_context); -// $schemas = [new OA\Schema(['ref' => $this->modelRegistry->register(new Model($type, $groups, null, $context)), '_context' => $weakContext])]; -// -// if ( -// function_exists('enum_exists') -// && enum_exists($type->getClassName()) -// && version_compare($weakContext->version, OA\OpenApi::VERSION_3_1_0, '<') -// ) { -// $property->allOf = $schemas; -// } else { -// $property->oneOf = $schemas; -// } -// -// return; -// } + if ($types[0]->isNullable()) { + $weakContext = Util::createWeakContext($property->_context); + $schemas = [new OA\Schema(['ref' => $this->modelRegistry->register(new Model($type, $groups, null, $context)), '_context' => $weakContext])]; + $property->oneOf = $schemas; + + return; + } $property->ref = $this->modelRegistry->register(new Model($type, $groups, null, $context)); }