diff --git a/src/Hydra/JsonSchema/SchemaFactory.php b/src/Hydra/JsonSchema/SchemaFactory.php index cd7eed0dcd..4dd3e78047 100644 --- a/src/Hydra/JsonSchema/SchemaFactory.php +++ b/src/Hydra/JsonSchema/SchemaFactory.php @@ -170,14 +170,7 @@ public function buildSchema(string $className, string $format = 'jsonld', string $definitions[self::COLLECTION_BASE_SCHEMA_NAME] = [ 'type' => 'object', - 'required' => [ - $hydraPrefix.'member', - ], 'properties' => [ - $hydraPrefix.'member' => [ - 'type' => 'array', - 'items' => ['type' => 'object'], - ], $hydraPrefix.'totalItems' => [ 'type' => 'integer', 'minimum' => 0, @@ -249,6 +242,9 @@ public function buildSchema(string $className, string $format = 'jsonld', string ['$ref' => $prefix.self::COLLECTION_BASE_SCHEMA_NAME], [ 'type' => 'object', + 'required' => [ + $hydraPrefix.'member', + ], 'properties' => [ $hydraPrefix.'member' => [ 'type' => 'array', diff --git a/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php b/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php index 25f1a2ffda..149d68fa02 100644 --- a/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php +++ b/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php @@ -132,7 +132,6 @@ public function testSchemaTypeBuildSchema(): void $this->assertNull($resultSchema->getRootDefinitionKey()); $hydraCollectionSchema = $resultSchema['definitions']['HydraCollectionBaseSchema']; $properties = $hydraCollectionSchema['properties']; - $this->assertTrue(isset($properties['hydra:member'])); $this->assertArrayHasKey('hydra:totalItems', $properties); $this->assertArrayHasKey('hydra:view', $properties); $this->assertArrayHasKey('hydra:search', $properties); diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue7432/OriginalDataWithListeners.php b/tests/Fixtures/TestBundle/ApiResource/Issue7432/OriginalDataWithListeners.php index a16983cabd..bc1b3fe2cb 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue7432/OriginalDataWithListeners.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue7432/OriginalDataWithListeners.php @@ -33,7 +33,10 @@ public static function process($data, Operation $operation, array $uriVariables { \assert($data instanceof UserVerifyInput); \assert($context['previous_data'] instanceof self); + \assert($context['read_data'] instanceof self); + \assert($context['previous_data'] !== $context['read_data']); \assert($context['request']->attributes->get('data') instanceof UserVerifyInput); + \assert($context['request']->attributes->get('read_data') instanceof self); \assert($context['request']->attributes->get('previous_data') instanceof self); \assert($context['data'] instanceof UserVerifyInput); $context['previous_data']->code = $data->code;