Skip to content

Commit 6b12346

Browse files
committed
feature #310 [Platform] Remove required parameter from #[With] attribute (junaidbinfarooq)
This PR was merged into the main branch. Discussion ---------- [Platform] Remove required parameter from `#[With]` attribute | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | Fix #294 | License | MIT # Changes proposed: The PR aims to fix the linked issue by removing the required parameter from the `With` attribute, as all the required properties are inferred from type definitions and put into the required property in the generated JSON Commits ------- ecc141b fix(json-schema): Remove required parameter from With attribute as the required properties are inferred from type definition
2 parents 1336ce7 + ecc141b commit 6b12346

File tree

4 files changed

+0
-10
lines changed

4 files changed

+0
-10
lines changed

fixtures/Tool/ToolWithToolParameterAttribute.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public function __invoke(
5959
)]
6060
array $products,
6161
#[With(
62-
required: true,
6362
minProperties: 1,
6463
maxProperties: 10,
6564
dependentRequired: true,

src/platform/src/Contract/JsonSchema/Attribute/With.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function __construct(
4848
public ?int $maxContains = null,
4949

5050
// object
51-
public ?bool $required = null,
5251
public ?int $minProperties = null,
5352
public ?int $maxProperties = null,
5453
public ?bool $dependentRequired = null,

src/platform/tests/Contract/JsonSchema/Attribute/ToolParameterTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,6 @@ public function testInvalidMaxContainsLessThanMinContains()
172172
new With(minContains: 3, maxContains: 1);
173173
}
174174

175-
public function testValidRequired()
176-
{
177-
$toolParameter = new With(required: true);
178-
$this->assertTrue($toolParameter->required);
179-
}
180-
181175
public function testValidMinPropertiesAndMaxProperties()
182176
{
183177
$minProperties = 1;
@@ -217,7 +211,6 @@ enum: ['value1', 'value2'],
217211
uniqueItems: true,
218212
minContains: 1,
219213
maxContains: 5,
220-
required: true,
221214
minProperties: 1,
222215
maxProperties: 5,
223216
dependentRequired: true

src/platform/tests/Contract/JsonSchema/FactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public function testBuildParametersDefinitionRequiredWithAdditionalToolParameter
119119
'shippingAddress' => [
120120
'type' => 'string',
121121
'description' => 'The shipping address given to the tool',
122-
'required' => true,
123122
'minProperties' => 1,
124123
'maxProperties' => 10,
125124
'dependentRequired' => true,

0 commit comments

Comments
 (0)