Skip to content

Commit 3c8659f

Browse files
committed
fix(hydra): rdfs:label should not duplicate title
1 parent a4d6ac4 commit 3c8659f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Hydra/Serializer/DocumentationNormalizer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private function populateEntrypointProperties(ApiResource $resourceMetadata, str
9999
'@id' => \sprintf('#Entrypoint/%s', lcfirst($shortName)),
100100
'@type' => $hydraPrefix.'Link',
101101
'domain' => '#Entrypoint',
102-
'rdfs:label' => "The collection of $shortName resources",
102+
'rdfs:label' => "get{$shortName}Collection",
103103
'rdfs:range' => [
104104
['@id' => $hydraPrefix.'Collection'],
105105
[
@@ -313,8 +313,9 @@ private function getHydraOperation(HttpOperation $operation, string $prefixedSho
313313

314314
$hydraOperation[$hydraPrefix.'method'] ?? $hydraOperation[$hydraPrefix.'method'] = $method;
315315

316-
if (!isset($hydraOperation['rdfs:label']) && isset($hydraOperation[$hydraPrefix.'title'])) {
317-
$hydraOperation['rdfs:label'] = $hydraOperation[$hydraPrefix.'title'];
316+
if (!isset($hydraOperation['rdfs:label'])) {
317+
// we know that this name is unique
318+
$hydraOperation['rdfs:label'] = $operation->getName();
318319
}
319320

320321
ksort($hydraOperation);
@@ -429,7 +430,8 @@ private function getClasses(array $entrypointProperties, array $classes, string
429430
$hydraPrefix.'supportedOperation' => [
430431
'@type' => $hydraPrefix.'Operation',
431432
$hydraPrefix.'method' => 'GET',
432-
'rdfs:label' => 'The API entrypoint.',
433+
'title' => 'The API entrypoint.',
434+
'rdfs:label' => 'getEntrypoint',
433435
'returns' => 'EntryPoint',
434436
],
435437
];

0 commit comments

Comments
 (0)