Skip to content

Commit

Permalink
fix(hydra): rdfs:label should not duplicate title
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Oct 24, 2024
1 parent a4d6ac4 commit 3c8659f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Hydra/Serializer/DocumentationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function populateEntrypointProperties(ApiResource $resourceMetadata, str
'@id' => \sprintf('#Entrypoint/%s', lcfirst($shortName)),
'@type' => $hydraPrefix.'Link',
'domain' => '#Entrypoint',
'rdfs:label' => "The collection of $shortName resources",
'rdfs:label' => "get{$shortName}Collection",
'rdfs:range' => [
['@id' => $hydraPrefix.'Collection'],
[
Expand Down Expand Up @@ -313,8 +313,9 @@ private function getHydraOperation(HttpOperation $operation, string $prefixedSho

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

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

ksort($hydraOperation);
Expand Down Expand Up @@ -429,7 +430,8 @@ private function getClasses(array $entrypointProperties, array $classes, string
$hydraPrefix.'supportedOperation' => [
'@type' => $hydraPrefix.'Operation',
$hydraPrefix.'method' => 'GET',
'rdfs:label' => 'The API entrypoint.',
'title' => 'The API entrypoint.',
'rdfs:label' => 'getEntrypoint',
'returns' => 'EntryPoint',
],
];
Expand Down

0 comments on commit 3c8659f

Please sign in to comment.