Skip to content

Commit b1fd1f6

Browse files
committed
fix(jsonapi): emit no empty properties list in attributes
Fixes #8756
1 parent 7e1cb30 commit b1fd1f6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/JsonApi/JsonSchema/SchemaFactory.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ final class SchemaFactory implements SchemaFactoryInterface, SchemaFactoryAwareI
7171
],
7272
'attributes' => [
7373
'type' => 'object',
74-
'properties' => [],
7574
],
7675
];
7776

@@ -350,7 +349,9 @@ private function buildDefinitionPropertiesSchema(string $key, string $documentDe
350349
}
351350

352351
$replacement = self::PROPERTY_PROPS;
353-
$replacement['attributes']['properties'] = $attributes;
352+
if ([] !== $attributes) {
353+
$replacement['attributes']['properties'] = $attributes;
354+
}
354355

355356
$included = [];
356357
if (\count($relationships) > 0) {

‎src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public function testHasRootDefinitionKeyBuildSchema(): void
120120
],
121121
'attributes' => [
122122
'type' => 'object',
123-
'properties' => [],
124123
],
125124
],
126125
'required' => [

0 commit comments

Comments
 (0)