@@ -243,8 +243,7 @@ private function getHydraOperations(bool $collection, ?ResourceMetadataCollectio
243243 if (('POST ' === $ operation ->getMethod () || $ operation instanceof CollectionOperationInterface) !== $ collection ) {
244244 continue ;
245245 }
246-
247- $ hydraOperations [] = $ this ->getHydraOperation ($ operation , $ operation ->getTypes ()[0 ] ?? "# {$ operation ->getShortName ()}" , $ hydraPrefix );
246+ $ hydraOperations [] = $ this ->getHydraOperation ($ operation , $ operation ->getTypes ()[0 ] ?? $ operation ->getShortName (), $ hydraPrefix );
248247 }
249248 }
250249
@@ -270,6 +269,10 @@ private function getHydraOperation(HttpOperation $operation, string $prefixedSho
270269 $ inputClass = \array_key_exists ('class ' , $ inputMetadata ) ? $ inputMetadata ['class ' ] : false ;
271270 $ outputClass = \array_key_exists ('class ' , $ outputMetadata ) ? $ outputMetadata ['class ' ] : false ;
272271
272+ if (str_starts_with ($ prefixedShortName , '# ' )) {
273+ $ prefixedShortName = substr ($ prefixedShortName , 1 );
274+ }
275+
273276 if ('GET ' === $ method && $ operation instanceof CollectionOperationInterface) {
274277 $ hydraOperation += [
275278 '@type ' => [$ hydraPrefix .'Operation ' , 'schema:FindAction ' ],
@@ -280,28 +283,28 @@ private function getHydraOperation(HttpOperation $operation, string $prefixedSho
280283 $ hydraOperation += [
281284 '@type ' => [$ hydraPrefix .'Operation ' , 'schema:FindAction ' ],
282285 $ hydraPrefix .'title ' => "Retrieves a $ shortName resource. " ,
283- 'returns ' => null === $ outputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
286+ 'returns ' => null === $ outputClass ? 'owl:Nothing ' : $ prefixedShortName ,
284287 ];
285288 } elseif ('PATCH ' === $ method ) {
286289 $ hydraOperation += [
287290 '@type ' => $ hydraPrefix .'Operation ' ,
288291 $ hydraPrefix .'title ' => "Updates the $ shortName resource. " ,
289- 'returns ' => null === $ outputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
290- 'expects ' => null === $ inputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
292+ 'returns ' => null === $ outputClass ? 'owl:Nothing ' : $ prefixedShortName ,
293+ 'expects ' => null === $ inputClass ? 'owl:Nothing ' : $ prefixedShortName ,
291294 ];
292295 } elseif ('POST ' === $ method ) {
293296 $ hydraOperation += [
294297 '@type ' => [$ hydraPrefix .'Operation ' , 'schema:CreateAction ' ],
295298 $ hydraPrefix .'title ' => "Creates a $ shortName resource. " ,
296- 'returns ' => null === $ outputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
297- 'expects ' => null === $ inputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
299+ 'returns ' => null === $ outputClass ? 'owl:Nothing ' : $ prefixedShortName ,
300+ 'expects ' => null === $ inputClass ? 'owl:Nothing ' : $ prefixedShortName ,
298301 ];
299302 } elseif ('PUT ' === $ method ) {
300303 $ hydraOperation += [
301304 '@type ' => [$ hydraPrefix .'Operation ' , 'schema:ReplaceAction ' ],
302305 $ hydraPrefix .'title ' => "Replaces the $ shortName resource. " ,
303- 'returns ' => null === $ outputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
304- 'expects ' => null === $ inputClass ? 'owl:Nothing ' : substr ( $ prefixedShortName, 1 ) ,
306+ 'returns ' => null === $ outputClass ? 'owl:Nothing ' : $ prefixedShortName ,
307+ 'expects ' => null === $ inputClass ? 'owl:Nothing ' : $ prefixedShortName ,
305308 ];
306309 } elseif ('DELETE ' === $ method ) {
307310 $ hydraOperation += [
0 commit comments