Skip to content

Commit c9caacb

Browse files
committed
chore(api): fixed swagger doc for attributes
1 parent 8261daf commit c9caacb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/ApiPlatform/Resources/Attribute/Attribute.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ class Attribute
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 = [
@@ -116,7 +125,7 @@ class Attribute
116125
];
117126

118127
public const CREATE_COMMAND_MAPPING = [
119-
'[names]' => '[localizedValue]',
128+
'[names]' => '[localizedNames]',
120129
'[shopIds]' => '[associatedShopIds]',
121130
];
122131

0 commit comments

Comments
 (0)