Skip to content

Commit 6bdc4f4

Browse files
author
RobertGroot
committed
Datacollection fix
1 parent 278b927 commit 6bdc4f4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Data/Operation.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@
66
use Exception;
77
use Illuminate\Routing\Route;
88
use ReflectionFunction;
9+
use Spatie\LaravelData\Attributes\DataCollectionOf;
910
use Spatie\LaravelData\Data;
1011
use Spatie\LaravelData\DataCollection;
1112
use Spatie\LaravelData\Support\Wrapping\WrapExecutionType;
1213

1314
class Operation extends Data
1415
{
1516
public function __construct(
16-
/** @var DataCollection<int,Parameter> */
17+
/** @var null|DataCollection<int,Parameter> */
18+
#[DataCollectionOf(Parameter::class)]
1719
public ?DataCollection $parameters,
1820
public ?RequestBody $requestBody,
1921
public DefaultResponse $responses,
2022
/** @var null|DataCollection<int,SecurityScheme> */
23+
#[DataCollectionOf(SecurityScheme::class)]
2124
public ?DataCollection $security,
2225
) {
2326
}

src/Data/Schema.php

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use ReflectionNamedType;
1414
use ReflectionParameter;
1515
use ReflectionProperty;
16+
use Spatie\LaravelData\Attributes\DataCollectionOf;
1617
use Spatie\LaravelData\Data;
1718
use Spatie\LaravelData\Data as LaravelData;
1819
use Spatie\LaravelData\DataCollection;
@@ -35,6 +36,7 @@ public function __construct(
3536
public ?Schema $items = null,
3637
public ?string $ref = null,
3738
/** @var DataCollection<int,Property> */
39+
#[DataCollectionOf(Property::class)]
3840
protected ?DataCollection $properties = null,
3941
) {
4042
$this->type = self::CASTS[$this->type] ?? $this->type;

0 commit comments

Comments
 (0)