Skip to content

Commit 201be11

Browse files
committed
chore(api): fixed swagger doc for attributes
1 parent 533bd7e commit 201be11

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/ApiPlatform/Resources/Attribute/Attribute.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,21 @@
8585
)]
8686
class Attribute
8787
{
88-
#[ApiProperty(identifier: true)]
88+
#[ApiProperty(identifier: true, writable: false)]
8989
public int $attributeId;
9090

9191
#[ApiProperty(openapiContext: ['type' => 'integer', 'example' => 1])]
9292
public int $attributeGroupId;
9393

9494
#[LocalizedValue]
95+
#[ApiProperty(
96+
openapiContext: [
97+
'type' => 'object',
98+
'example' => ['en-US' => 'Value name', 'fr-FR' => 'Nom de la valeur'],
99+
'description' => 'Localized attribute names indexed by locale (e.g., en-US, fr-FR). Required for creation.',
100+
]
101+
)]
102+
#[Assert\NotBlank(groups: ['Create'])]
95103
#[DefaultLanguage(groups: ['Create'], fieldName: 'names')]
96104
#[DefaultLanguage(groups: ['Update'], fieldName: 'names', allowNull: true)]
97105
#[Assert\All(constraints: [
@@ -107,6 +115,7 @@ class Attribute
107115
#[Assert\NotBlank(allowNull: true)]
108116
public array $shopIds;
109117

118+
#[ApiProperty(writable: false)]
110119
public int $position;
111120

112121
public const QUERY_MAPPING = [

0 commit comments

Comments
 (0)