Skip to content

Commit c6670dc

Browse files
docs(openapi): add custom UI template override for Laravel (#2113)
Added documentation on overriding the default OpenAPI UI template.
1 parent 46491a6 commit c6670dc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: core/openapi.md

+26
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,10 @@ framework:
717717

718718
## Overriding the UI Template
719719

720+
You can extend the default UI Template using the Symfony and Laravel instructions below:
721+
722+
### Overriding the UI Template using Symfony
723+
720724
As described [in the Symfony documentation](https://symfony.com/doc/current/templating/overriding.html), it's possible to override the Twig template that loads Swagger UI and renders the documentation:
721725

722726
```twig
@@ -732,6 +736,28 @@ As described [in the Symfony documentation](https://symfony.com/doc/current/temp
732736

733737
You may want to copy the [one shipped with API Platform](https://github.com/api-platform/core/blob/main/src/Symfony/Bundle/Resources/views/SwaggerUi/index.html.twig) and customize it.
734738

739+
### Overriding the UI Template using Laravel
740+
741+
As described [in the Laravel documentation](https://laravel.com/docs/blade#extending-a-layout), it's possible to override the Blade template that loads Swagger UI and renders the documentation:
742+
743+
```blade
744+
{# resources/views/swagger-ui.blade.php #}
745+
<!DOCTYPE html>
746+
<html>
747+
<head>
748+
<meta charset="UTF-8">
749+
<title>
750+
@if(isset($title))
751+
{{ $title }}
752+
@endif
753+
My custom template
754+
</title>
755+
{# ... #}
756+
</html>
757+
```
758+
759+
You may want to copy the [one shipped with API Platform](https://github.com/api-platform/core/blob/main/src/Laravel/resources/views/swagger-ui.blade.php) and customize it.
760+
735761
## Compatibility Layer with Amazon API Gateway
736762

737763
[AWS API Gateway](https://aws.amazon.com/api-gateway/) supports OpenAPI partially, but it [requires some changes](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html).

0 commit comments

Comments
 (0)