Skip to content

Commit

Permalink
Merge pull request #5 from whitedigital-eu/feature/improve-openapi-do…
Browse files Browse the repository at this point in the history
…c-generation

Feature/improve openapi doc generation
  • Loading branch information
iliepins-wd authored Nov 15, 2024
2 parents 7a4948b + 42426ac commit fba84d3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Api/Resource/StorageItemResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@ class StorageItemResource extends BaseResource

public const PREFIX = 'storage_item:';

#[ApiProperty(identifier: true)]
#[ApiProperty(
required: true,
identifier: true,
openapiContext: ['type' => 'integer'],
)]
#[Groups([self::ITEM, self::READ, ])]
public mixed $id = null;

#[ApiProperty(types: ['https://schema.org/contentUrl', ])]
#[ApiProperty(
required: true,
types: ['https://schema.org/contentUrl', ],
schema: ['type' => 'string'],
)]
#[Groups([self::ITEM, self::READ, ])]
public ?string $contentUrl = null;

Expand All @@ -100,6 +108,7 @@ class StorageItemResource extends BaseResource
public ?File $file = null;

#[Groups([self::ITEM, self::READ, ])]
#[ApiProperty(required: true, schema: ['type' => 'string'])]
public ?string $filePath = null;

#[Groups([self::ITEM, self::READ, ])]
Expand All @@ -118,14 +127,17 @@ class StorageItemResource extends BaseResource
public ?string $title = null;

#[Groups([self::ITEM, self::READ, ])]
#[ApiProperty(required: true, schema: ['type' => 'string'])]
public ?DateTimeImmutable $createdAt = null;

#[Groups([self::ITEM, self::READ, ])]
#[ApiProperty(required: true, schema: ['type' => 'string'])]
public ?DateTimeImmutable $updatedAt = null;

#[Groups([self::ITEM, self::READ, ])]
public ?bool $isImage = null;

#[Groups([self::ITEM, self::WRITE, self::PATCH, self::READ, ])]
#[ApiProperty(openapiContext: ['type' => 'object', 'additionalProperties' => true])]
public ?array $data = null;
}

0 comments on commit fba84d3

Please sign in to comment.