Skip to content

Commit 174af0b

Browse files
committed
null is not supported
1 parent b8a7687 commit 174af0b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Chain/JsonSchema/Factory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ private function convertTypes(array $elements): ?array
9696
$type = $this->typeResolver->resolve($element);
9797
$schema = $this->getTypeSchema($type);
9898

99-
if ($type->isNullable() || ($element instanceof \ReflectionParameter && $element->isOptional())) {
99+
if ($type->isNullable()) {
100100
$schema['type'] = [$schema['type'], 'null'];
101-
} else {
101+
} elseif (!($element instanceof \ReflectionParameter && $element->isOptional())) {
102102
$result['required'][] = $name;
103103
}
104104

tests/Chain/Toolbox/ToolboxTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function toolsMap(): void
9696
'description' => 'The text given to the tool',
9797
],
9898
'number' => [
99-
'type' => ['integer', 'null'],
99+
'type' => 'integer',
100100
'description' => 'A number given to the tool',
101101
],
102102
],
@@ -245,7 +245,7 @@ public function toolboxMapWithOverrideViaChain(): void
245245
'description' => 'The text given to the tool',
246246
],
247247
'number' => [
248-
'type' => ['integer', 'null'],
248+
'type' => 'integer',
249249
'description' => 'A number given to the tool',
250250
],
251251
],

0 commit comments

Comments
 (0)