@@ -48,6 +48,8 @@ public function __construct(
4848 private readonly bool $ scalarEnabled = false ,
4949 private readonly array $ scalarExtraConfiguration = [],
5050 private readonly bool $ redocEnabled = false ,
51+ private readonly bool $ graphQlEnabled = false ,
52+ private readonly bool $ graphiQlEnabled = false ,
5153 ) {
5254 }
5355
@@ -62,8 +64,8 @@ public function process(mixed $openApi, Operation $operation, array $uriVariable
6264 'formats ' => $ this ->formats ,
6365 'title ' => $ openApi ->getInfo ()->getTitle (),
6466 'description ' => $ openApi ->getInfo ()->getDescription (),
65- 'originalRoute ' => $ request ->attributes ->get ('_api_original_route ' , $ request ->attributes -> get ( ' _route ' ) ),
66- 'originalRouteParams ' => $ request ->attributes ->get ('_api_original_route_params ' , $ request ->attributes -> get ( ' _route_params ' , [])) ,
67+ 'originalRoute ' => $ request ->attributes ->get ('_api_original_route ' ) ?? $ request ->route ()?->getName( ),
68+ 'originalRouteParams ' => $ request ->attributes ->get ('_api_original_route_params ' ) ?? $ request ->route ()?->parameters() ?? [] ,
6769 ];
6870
6971 $ swaggerData = [
@@ -99,7 +101,15 @@ public function process(mixed $openApi, Operation $operation, array $uriVariable
99101
100102 $ swaggerData ['scalarExtraConfiguration ' ] = $ this ->scalarExtraConfiguration ;
101103
102- return new Response (view ('api-platform::swagger-ui ' , $ swaggerContext + ['swagger_data ' => $ swaggerData , 'ui ' => $ this ->getUi ()]), 200 );
104+ return new Response (view ('api-platform::swagger-ui ' , $ swaggerContext + [
105+ 'swagger_data ' => $ swaggerData ,
106+ 'ui ' => $ this ->getUi (),
107+ 'swaggerUiEnabled ' => $ this ->swaggerEnabled ,
108+ 'redocEnabled ' => $ this ->redocEnabled ,
109+ 'scalarEnabled ' => $ this ->scalarEnabled ,
110+ 'graphQlEnabled ' => $ this ->graphQlEnabled ,
111+ 'graphiQlEnabled ' => $ this ->graphiQlEnabled ,
112+ ]), 200 );
103113 }
104114
105115 /**
0 commit comments