Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testCreate()
'isActive' => ['type' => 'boolean'],
'age' => ['type' => ['integer', 'null']],
],
'required' => ['id', 'name', 'createdAt', 'isActive'],
'required' => ['id', 'name', 'createdAt', 'isActive', 'age'],
'additionalProperties' => false,
],
'strict' => true,
Expand Down
1 change: 1 addition & 0 deletions src/platform/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
0.1
---

* Add nullables as required in structured outputs
* Add support for Albert API for French/EU data sovereignty
* Add unified abstraction layer for interacting with various AI models and providers
* Add support for 16+ AI providers:
Expand Down
4 changes: 3 additions & 1 deletion src/platform/src/Contract/JsonSchema/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private function convertTypes(array $elements): ?array
if (!isset($schema['anyOf'])) {
$schema['type'] = [$schema['type'], 'null'];
}
} elseif (!($element instanceof \ReflectionParameter && $element->isOptional())) {
}

if (!($element instanceof \ReflectionParameter && $element->isOptional())) {
$result['required'][] = $name;
}

Expand Down
6 changes: 3 additions & 3 deletions src/platform/tests/Contract/JsonSchema/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function testBuildPropertiesForUserClass()
'isActive' => ['type' => 'boolean'],
'age' => ['type' => ['integer', 'null']],
],
'required' => ['id', 'name', 'createdAt', 'isActive'],
'required' => ['id', 'name', 'createdAt', 'isActive', 'age'],
'additionalProperties' => false,
];

Expand Down Expand Up @@ -304,7 +304,7 @@ public function testBuildPropertiesForUnionTypeDto()
],
],
],
'required' => [],
'required' => ['time'],
'additionalProperties' => false,
];

Expand Down Expand Up @@ -347,7 +347,7 @@ public function testBuildPropertiesForExampleDto()
'enum' => ['Foo', 'Bar', null],
],
],
'required' => ['name', 'taxRate'],
'required' => ['name', 'taxRate', 'category'],
'additionalProperties' => false,
];

Expand Down