diff --git a/src/Hydra/Serializer/DocumentationNormalizer.php b/src/Hydra/Serializer/DocumentationNormalizer.php index 81ddaf17e4d..a9993656e17 100644 --- a/src/Hydra/Serializer/DocumentationNormalizer.php +++ b/src/Hydra/Serializer/DocumentationNormalizer.php @@ -101,11 +101,11 @@ private function populateEntrypointProperties(string $resourceClass, ResourceMet 'domain' => '#Entrypoint', 'rdfs:label' => "The collection of $shortName resources", 'rdfs:range' => [ - 'hydra:Collection', + ['@id' => 'hydra:Collection'], [ 'owl:equivalentClass' => [ - 'owl:onProperty' => 'hydra:member', - 'owl:allValuesFrom' => "#$shortName", + 'owl:onProperty' => ['@id' => 'hydra:member'], + 'owl:allValuesFrom' => ['@id' => $prefixedShortName], ], ], ], diff --git a/tests/Hydra/Serializer/DocumentationNormalizerTest.php b/tests/Hydra/Serializer/DocumentationNormalizerTest.php index 2a9314432aa..d043081df54 100644 --- a/tests/Hydra/Serializer/DocumentationNormalizerTest.php +++ b/tests/Hydra/Serializer/DocumentationNormalizerTest.php @@ -131,14 +131,14 @@ public function testNormalize() 'hydra:title' => 'Test Api', 'hydra:description' => 'test ApiGerard', 'hydra:supportedClass' => [ - 0 => [ + [ '@id' => '#dummy', '@type' => 'hydra:Class', 'rdfs:label' => 'dummy', 'hydra:title' => 'dummy', 'hydra:description' => 'dummy', 'hydra:supportedProperty' => [ - 0 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#dummy/name', @@ -153,7 +153,7 @@ public function testNormalize() 'hydra:writable' => true, 'hydra:description' => 'name', ], - 1 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#dummy/description', @@ -168,7 +168,7 @@ public function testNormalize() 'hydra:writable' => true, 'hydra:description' => 'description', ], - 2 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#dummy/relatedDummy', @@ -185,7 +185,7 @@ public function testNormalize() ], ], 'hydra:supportedOperation' => [ - 0 => [ + [ '@type' => ['hydra:Operation', 'schema:FindAction'], 'hydra:method' => 'GET', 'hydra:title' => 'foobar', @@ -193,7 +193,7 @@ public function testNormalize() 'returns' => '#dummy', 'hydra:foo' => 'bar', ], - 1 => [ + [ '@type' => ['hydra:Operation', 'schema:ReplaceAction'], 'expects' => '#dummy', 'hydra:method' => 'PUT', @@ -201,7 +201,7 @@ public function testNormalize() 'rdfs:label' => 'Replaces the dummy resource.', 'returns' => '#dummy', ], - 2 => [ + [ '@type' => ['hydra:Operation', 'schema:FindAction'], 'hydra:method' => 'GET', 'hydra:title' => 'Retrieves a relatedDummy resource.', @@ -210,12 +210,12 @@ public function testNormalize() ], ], ], - 1 => [ + [ '@id' => '#Entrypoint', '@type' => 'hydra:Class', 'hydra:title' => 'The API entrypoint', 'hydra:supportedProperty' => [ - 0 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#Entrypoint/dummy', @@ -223,23 +223,23 @@ public function testNormalize() 'rdfs:label' => 'The collection of dummy resources', 'domain' => '#Entrypoint', 'rdfs:range' => [ - 'hydra:Collection', + ['@id' => 'hydra:Collection'], [ 'owl:equivalentClass' => [ - 'owl:onProperty' => 'hydra:member', - 'owl:allValuesFrom' => '#dummy', + 'owl:onProperty' => ['@id' => 'hydra:member'], + 'owl:allValuesFrom' => ['@id' => '#dummy'], ], ], ], 'hydra:supportedOperation' => [ - 0 => [ + [ '@type' => ['hydra:Operation', 'schema:FindAction'], 'hydra:method' => 'GET', 'hydra:title' => 'Retrieves the collection of dummy resources.', 'rdfs:label' => 'Retrieves the collection of dummy resources.', 'returns' => 'hydra:Collection', ], - 1 => [ + [ '@type' => ['hydra:Operation', 'schema:CreateAction'], 'expects' => '#dummy', 'hydra:method' => 'POST', @@ -247,7 +247,7 @@ public function testNormalize() 'rdfs:label' => 'Creates a dummy resource.', 'returns' => '#dummy', ], - 2 => [ + [ '@type' => ['hydra:Operation', 'schema:FindAction'], 'hydra:method' => 'GET', 'hydra:title' => 'Retrieves a relatedDummy resource.', @@ -268,12 +268,12 @@ public function testNormalize() 'returns' => '#EntryPoint', ], ], - 2 => [ + [ '@id' => '#ConstraintViolation', '@type' => 'hydra:Class', 'hydra:title' => 'A constraint violation', 'hydra:supportedProperty' => [ - 0 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#ConstraintViolation/propertyPath', @@ -287,7 +287,7 @@ public function testNormalize() 'hydra:readable' => true, 'hydra:writable' => false, ], - 1 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#ConstraintViolation/message', @@ -303,13 +303,13 @@ public function testNormalize() ], ], ], - 3 => [ + [ '@id' => '#ConstraintViolationList', '@type' => 'hydra:Class', 'subClassOf' => 'hydra:Error', 'hydra:title' => 'A constraint violation list', 'hydra:supportedProperty' => [ - 0 => [ + [ '@type' => 'hydra:SupportedProperty', 'hydra:property' => [ '@id' => '#ConstraintViolationList/violations',