@@ -74,6 +74,7 @@ public function normalize(mixed $object, ?string $format = null, array $context
74
74
}
75
75
76
76
$ shortName = $ resourceMetadata ->getShortName ();
77
+
77
78
$ prefixedShortName = $ resourceMetadata ->getTypes ()[0 ] ?? "# $ shortName " ;
78
79
$ this ->populateEntrypointProperties ($ resourceMetadata , $ shortName , $ prefixedShortName , $ entrypointProperties , $ hydraPrefix , $ resourceMetadataCollection );
79
80
$ classes [] = $ this ->getClass ($ resourceClass , $ resourceMetadata , $ shortName , $ prefixedShortName , $ context , $ hydraPrefix , $ resourceMetadataCollection );
@@ -243,8 +244,7 @@ private function getHydraOperations(bool $collection, ?ResourceMetadataCollectio
243
244
if (('POST ' === $ operation ->getMethod () || $ operation instanceof CollectionOperationInterface) !== $ collection ) {
244
245
continue ;
245
246
}
246
-
247
- $ hydraOperations [] = $ this ->getHydraOperation ($ operation , $ operation ->getTypes ()[0 ] ?? "# {$ operation ->getShortName ()}" , $ hydraPrefix );
247
+ $ hydraOperations [] = $ this ->getHydraOperation ($ operation , $ operation ->getShortName (), $ hydraPrefix );
248
248
}
249
249
}
250
250
@@ -430,7 +430,7 @@ private function getClasses(array $entrypointProperties, array $classes, string
430
430
'@type ' => $ hydraPrefix .'Operation ' ,
431
431
$ hydraPrefix .'method ' => 'GET ' ,
432
432
'rdfs:label ' => 'The API entrypoint. ' ,
433
- 'returns ' => '# EntryPoint ' ,
433
+ 'returns ' => 'EntryPoint ' ,
434
434
],
435
435
];
436
436
@@ -573,18 +573,19 @@ private function computeDoc(Documentation $object, array $classes, string $hydra
573
573
private function getContext (string $ hydraPrefix = ContextBuilder::HYDRA_PREFIX ): array
574
574
{
575
575
return [
576
- '@vocab ' => $ this ->urlGenerator ->generate ('api_doc ' , ['_format ' => self ::FORMAT ], UrlGeneratorInterface::ABS_URL ).'# ' ,
577
- 'hydra ' => ContextBuilderInterface::HYDRA_NS ,
578
- 'rdf ' => ContextBuilderInterface::RDF_NS ,
579
- 'rdfs ' => ContextBuilderInterface::RDFS_NS ,
580
- 'xmls ' => ContextBuilderInterface::XML_NS ,
581
- 'owl ' => ContextBuilderInterface::OWL_NS ,
582
- 'schema ' => ContextBuilderInterface::SCHEMA_ORG_NS ,
583
- 'domain ' => ['@id ' => 'rdfs:domain ' , '@type ' => '@id ' ],
584
- 'range ' => ['@id ' => 'rdfs:range ' , '@type ' => '@id ' ],
585
- 'subClassOf ' => ['@id ' => 'rdfs:subClassOf ' , '@type ' => '@id ' ],
586
- 'expects ' => ['@id ' => $ hydraPrefix .'expects ' , '@type ' => '@id ' ],
587
- 'returns ' => ['@id ' => $ hydraPrefix .'returns ' , '@type ' => '@id ' ],
576
+ ContextBuilderInterface::HYDRA_CONTEXT ,
577
+ [
578
+ '@vocab ' => $ this ->urlGenerator ->generate ('api_doc ' , ['_format ' => self ::FORMAT ], UrlGeneratorInterface::ABS_URL ).'# ' ,
579
+ 'hydra ' => ContextBuilderInterface::HYDRA_NS ,
580
+ 'rdf ' => ContextBuilderInterface::RDF_NS ,
581
+ 'rdfs ' => ContextBuilderInterface::RDFS_NS ,
582
+ 'xmls ' => ContextBuilderInterface::XML_NS ,
583
+ 'owl ' => ContextBuilderInterface::OWL_NS ,
584
+ 'schema ' => ContextBuilderInterface::SCHEMA_ORG_NS ,
585
+ 'domain ' => ['@id ' => 'rdfs:domain ' , '@type ' => '@id ' ],
586
+ 'range ' => ['@id ' => 'rdfs:range ' , '@type ' => '@id ' ],
587
+ 'subClassOf ' => ['@id ' => 'rdfs:subClassOf ' , '@type ' => '@id ' ],
588
+ ],
588
589
];
589
590
}
590
591
0 commit comments