Skip to content

Commit b1700eb

Browse files
committed
chore(api): fixed swagger doc for attributes
1 parent a5c62b9 commit b1700eb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/ApiPlatform/Resources/Attribute/Attribute.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class Attribute
9393
public int $attributeGroupId;
9494

9595
#[LocalizedValue]
96+
#[Assert\NotBlank(groups: ['Create'])]
9697
#[DefaultLanguage(groups: ['Create'], fieldName: 'names')]
9798
#[DefaultLanguage(groups: ['Update'], fieldName: 'names', allowNull: true)]
9899
#[Assert\All(constraints: [
@@ -108,8 +109,6 @@ class Attribute
108109
#[Assert\NotBlank(allowNull: true)]
109110
public array $shopIds;
110111

111-
public int $position;
112-
113112
public const QUERY_MAPPING = [
114113
'[localizedNames]' => '[names]',
115114
'[name]' => '[names]',

tests/Integration/ApiPlatform/ContactEndpointTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ public function testPartialUpdateContact(int $contactId): int
131131
$updatedContact = $this->partialUpdateItem('/contacts/' . $contactId, $patchData, ['contact_write']);
132132
$this->assertSame($patchData['names'], $updatedContact['names']);
133133
$this->assertSame($patchData['email'], $updatedContact['email']);
134-
$this->assertSame((bool) $patchData['messagesSavingEnabled'], (bool) $updatedContact['messagesSavingEnabled']);
134+
135+
// We check that when we GET the item it is updated as expected
136+
$contact = $this->getItem('/contacts/' . $contactId, ['contact_read']);
137+
$this->assertSame($patchData['names'], $contact['names']);
138+
$this->assertSame($patchData['email'], $contact['email']);
139+
$this->assertArrayHasKey('messagesSavingEnabled', $contact);
140+
$this->assertSame((bool) $patchData['messagesSavingEnabled'], (bool) $contact['messagesSavingEnabled']);
135141

136142
return $contactId;
137143
}

0 commit comments

Comments
 (0)