Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Jan 10, 2025
1 parent 4c6cda3 commit 2ad4e39
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Hydra/Serializer/DocumentationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ public function normalize(mixed $object, ?string $format = null, array $context
$resourceMetadataCollection = $this->resourceMetadataFactory->create($resourceClass);

$resourceMetadata = $resourceMetadataCollection[0];
if ($resourceMetadata instanceof ErrorResource && ValidationException::class === $resourceMetadata->getClass()) {
continue;
}

if (true === $resourceMetadata->getHideHydraOperation()) {
continue;
}
Expand Down Expand Up @@ -150,6 +146,10 @@ private function getClass(string $resourceClass, ApiResource $resourceMetadata,
$class[$hydraPrefix.'description'] = $description;
}

if ($resourceMetadata instanceof ErrorResource) {
$class['subClassOf'] = 'Error';
}

if ($isDeprecated) {
$class['owl:deprecated'] = true;
}
Expand Down Expand Up @@ -459,11 +459,12 @@ private function getClasses(array $entrypointProperties, array $classes, string
],
];

// Constraint violation
// // Constraint violation
// $classes[] = [
// '@id' => '#ConstraintViolation',
// '@type' => $hydraPrefix.'Class',
// $hydraPrefix.'title' => 'A constraint violation',
// $hydraPrefix.'title' => 'Constraint Violation',
// $hydraPrefix.'description' => 'A Constraint violation.',
// $hydraPrefix.'supportedProperty' => [
// [
// '@type' => $hydraPrefix.'SupportedProperty',
Expand Down Expand Up @@ -501,7 +502,8 @@ private function getClasses(array $entrypointProperties, array $classes, string
// '@id' => '#ConstraintViolationList',
// '@type' => $hydraPrefix.'Class',
// 'subClassOf' => $hydraPrefix.'Error',
// $hydraPrefix.'title' => 'A constraint violation list',
// $hydraPrefix.'title' => 'Constraint Violation List',
// $hydraPrefix.'description' => 'A Constraint violation list.',
// $hydraPrefix.'supportedProperty' => [
// [
// '@type' => $hydraPrefix.'SupportedProperty',
Expand Down

0 comments on commit 2ad4e39

Please sign in to comment.