@@ -705,7 +705,33 @@ public function register(): void
705
705
/** @var ConfigRepository */
706
706
$ config = $ app ['config ' ];
707
707
708
- return new Options (title: $ config ->get ('api-platform.title ' ) ?? '' );
708
+ return new Options (
709
+ title: $ config ->get ('api-platform.title ' , '' ),
710
+ description: $ config ->get ('api-platform.description ' , '' ),
711
+ version: $ config ->get ('api-platform.version ' , '' ),
712
+ oAuthEnabled: $ config ->get ('api-platform.swagger_ui.oauth.enabled ' , false ),
713
+ oAuthType: $ config ->get ('api-platform.swagger_ui.oauth.type ' , null ),
714
+ oAuthFlow: $ config ->get ('api-platform.swagger_ui.oauth.flow ' , null ),
715
+ oAuthTokenUrl: $ config ->get ('api-platform.swagger_ui.oauth.tokenUrl ' , null ),
716
+ oAuthAuthorizationUrl: $ config ->get ('api-platform.swagger_ui.oauth.authorizationUrl ' , null ),
717
+ oAuthRefreshUrl: $ config ->get ('api-platform.swagger_ui.oauth.refreshUrl ' , null ),
718
+ oAuthScopes: $ config ->get ('api-platform.swagger_ui.oauth.scopes ' , []),
719
+ apiKeys: $ config ->get ('api-platform.swagger_ui.apiKeys ' , []),
720
+ );
721
+ });
722
+
723
+ $ this ->app ->singleton (SwaggerUiProcessor::class, function (Application $ app ) {
724
+ /** @var ConfigRepository */
725
+ $ config = $ app ['config ' ];
726
+
727
+ return new SwaggerUiProcessor (
728
+ urlGenerator: $ app ->make (UrlGeneratorInterface::class),
729
+ normalizer: $ app ->make (NormalizerInterface::class),
730
+ openApiOptions: $ app ->make (Options::class),
731
+ oauthClientId: $ config ->get ('api-platform.swagger_ui.oauth.clientId ' ),
732
+ oauthClientSecret: $ config ->get ('api-platform.swagger_ui.oauth.clientSecret ' ),
733
+ oauthPkce: $ config ->get ('api-platform.swagger_ui.oauth.pkce ' , false ),
734
+ );
709
735
});
710
736
711
737
$ this ->app ->singleton (DocumentationController::class, function (Application $ app ) {
@@ -1267,14 +1293,6 @@ public function boot(ResourceNameCollectionFactoryInterface $resourceNameCollect
1267
1293
$ route ->name ('api_doc ' )->middleware (ApiPlatformMiddleware::class);
1268
1294
$ routeCollection ->add ($ route );
1269
1295
1270
- $ route = new Route (['GET ' ], $ prefix .'/{index?}{_format?} ' , function (Request $ request , Application $ app ) {
1271
- $ entrypointAction = $ app ->make (EntrypointController::class);
1272
-
1273
- return $ entrypointAction ->__invoke ($ request );
1274
- });
1275
- $ route ->where ('index ' , 'index ' );
1276
- $ route ->name ('api_entrypoint ' )->middleware (ApiPlatformMiddleware::class);
1277
- $ routeCollection ->add ($ route );
1278
1296
$ route = new Route (['GET ' ], $ prefix .'/.well-known/genid/{id} ' , function (): void {
1279
1297
throw new NotExposedHttpException ('This route is not exposed on purpose. It generates an IRI for a collection resource without identifier nor item operation. ' );
1280
1298
});
@@ -1297,6 +1315,15 @@ public function boot(ResourceNameCollectionFactoryInterface $resourceNameCollect
1297
1315
$ routeCollection ->add ($ route );
1298
1316
}
1299
1317
1318
+ $ route = new Route (['GET ' ], $ prefix .'/{index?}{_format?} ' , function (Request $ request , Application $ app ) {
1319
+ $ entrypointAction = $ app ->make (EntrypointController::class);
1320
+
1321
+ return $ entrypointAction ->__invoke ($ request );
1322
+ });
1323
+ $ route ->where ('index ' , 'index ' );
1324
+ $ route ->name ('api_entrypoint ' )->middleware (ApiPlatformMiddleware::class);
1325
+ $ routeCollection ->add ($ route );
1326
+
1300
1327
$ router ->setRoutes ($ routeCollection );
1301
1328
}
1302
1329
0 commit comments