You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/openapi.md
+36-8Lines changed: 36 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -420,30 +420,58 @@ resources:
420
420
421
421

422
422
423
-
## Changing the Location of Swagger UI
424
-
425
-
Sometimes you may want to have the API at one location, and the Swagger UI at a different location. This can be done by disabling the Swagger UI from the API Platform configuration file and manually adding the Swagger UI controller.
423
+
## Disabling Swagger UI or ReDoc
426
424
427
-
### Disabling Swagger UI or ReDoc
425
+
To disable Swagger UI (ReDoc will be shown by default):
428
426
429
427
```yaml
430
428
# api/config/packages/api_platform.yaml
431
429
api_platform:
432
430
# ...
433
431
enable_swagger_ui: false
432
+
```
433
+
434
+
To disable ReDoc:
435
+
436
+
```yaml
437
+
# api/config/packages/api_platform.yaml
438
+
api_platform:
439
+
# ...
434
440
enable_re_doc: false
435
441
```
436
442
437
-
### Manually Registering the Swagger UI Controller
443
+
## Changing the Location of Swagger UI
444
+
445
+
By default, the Swagger UI is available at the API location (when the HTML format is asked) and at the route `/docs`.
446
+
447
+
You may want to change its route and/or disable it at the API location.
448
+
449
+
### Changing the Route
450
+
451
+
Manually register the Swagger UI controller:
438
452
439
453
```yaml
440
454
# app/config/routes.yaml
441
-
swagger_ui:
442
-
path: /docs
455
+
api_doc:
456
+
path: /api_documentation
443
457
controller: api_platform.swagger.action.ui
444
458
```
445
459
446
-
Change `/docs` to the URI you wish Swagger to be accessible on.
460
+
Change `/api_documentation` to the URI you wish Swagger UI to be accessible on.
461
+
462
+
### Disabling Swagger UI at the API Location
463
+
464
+
To disable the Swagger UI at the API location, disable both Swagger UI and ReDoc:
465
+
466
+
```yaml
467
+
# api/config/packages/api_platform.yaml
468
+
api_platform:
469
+
# ...
470
+
enable_swagger_ui: false
471
+
enable_re_doc: false
472
+
```
473
+
474
+
If you have manually registered the Swagger UI controller, the Swagger UI will still be accessible at the route you have chosen.
0 commit comments