Skip to content

Commit 4c19bcd

Browse files
committed
fix(hydra): rdfs:label should not duplicate title
1 parent 9389b4f commit 4c19bcd

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
@@ -105,7 +105,7 @@ private function populateEntrypointProperties(ApiResource $resourceMetadata, str
105105
'@id' => \sprintf('#Entrypoint/%s', lcfirst($shortName)),
106106
'@type' => $hydraPrefix.'Link',
107107
'domain' => '#Entrypoint',
108-
'rdfs:label' => "The collection of $shortName resources",
108+
'rdfs:label' => "get{$shortName}Collection",
109109
'rdfs:range' => [
110110
['@id' => $hydraPrefix.'Collection'],
111111
[
@@ -323,8 +323,9 @@ private function getHydraOperation(HttpOperation $operation, string $prefixedSho
323323

324324
$hydraOperation[$hydraPrefix.'method'] ?? $hydraOperation[$hydraPrefix.'method'] = $method;
325325

326-
if (!isset($hydraOperation['rdfs:label']) && isset($hydraOperation[$hydraPrefix.'title'])) {
327-
$hydraOperation['rdfs:label'] = $hydraOperation[$hydraPrefix.'title'];
326+
if (!isset($hydraOperation['rdfs:label'])) {
327+
// we know that this name is unique
328+
$hydraOperation['rdfs:label'] = $operation->getName();
328329
}
329330

330331
ksort($hydraOperation);
@@ -439,7 +440,8 @@ private function getClasses(array $entrypointProperties, array $classes, string
439440
$hydraPrefix.'supportedOperation' => [
440441
'@type' => $hydraPrefix.'Operation',
441442
$hydraPrefix.'method' => 'GET',
442-
'rdfs:label' => 'The API entrypoint.',
443+
'title' => 'The API entrypoint.',
444+
'rdfs:label' => 'getEntrypoint',
443445
'returns' => 'EntryPoint',
444446
],
445447
];

0 commit comments

Comments
 (0)