Skip to content

docs(openapi): add custom UI template override for Laravel #2113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions core/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,10 @@ framework:

## Overriding the UI Template

You can extend the default UI Template using the Symfony and Laravel instructions below:

### Overriding the UI Template using Symfony

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:

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

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.

### Overriding the UI Template using Laravel

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:

```blade
{# resources/views/swagger-ui.blade.php #}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
@if(isset($title))
{{ $title }}
@endif
My custom template
</title>
{# ... #}
</html>
```

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.

## Compatibility Layer with Amazon API Gateway

[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).
Expand Down
Loading