Skip to content

Commit

Permalink
check for not wrapping enums with allOf
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartłomiej Nowak committed Mar 4, 2024
1 parent 35f2f01 commit 6cac88a
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/PropertyDescriber/ObjectPropertyDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 6cac88a

Please sign in to comment.