From b1fd1f6368c0e48ed515367faa45af403bfda0e2 Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 22 Oct 2026 16:06:58 +0200 Subject: [PATCH] fix(jsonapi): emit no empty properties list in attributes Fixes #8756 --- src/JsonApi/JsonSchema/SchemaFactory.php | 5 +++-- src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/JsonApi/JsonSchema/SchemaFactory.php b/src/JsonApi/JsonSchema/SchemaFactory.php index 67ac1998f9..6042dee5c7 100644 --- a/src/JsonApi/JsonSchema/SchemaFactory.php +++ b/src/JsonApi/JsonSchema/SchemaFactory.php @@ -71,7 +71,6 @@ final class SchemaFactory implements SchemaFactoryInterface, SchemaFactoryAwareI ], 'attributes' => [ 'type' => 'object', - 'properties' => [], ], ]; @@ -350,7 +349,9 @@ private function buildDefinitionPropertiesSchema(string $key, string $documentDe } $replacement = self::PROPERTY_PROPS; - $replacement['attributes']['properties'] = $attributes; + if ([] !== $attributes) { + $replacement['attributes']['properties'] = $attributes; + } $included = []; if (\count($relationships) > 0) { diff --git a/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php b/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php index 3a38b4595f..b93add1228 100644 --- a/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php +++ b/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php @@ -120,7 +120,6 @@ public function testHasRootDefinitionKeyBuildSchema(): void ], 'attributes' => [ 'type' => 'object', - 'properties' => [], ], ], 'required' => [