Skip to content

Commit

Permalink
docs(openapi): add custom UI template override for Laravel
Browse files Browse the repository at this point in the history
Added documentation on overriding the default OpenAPI UI template.
  • Loading branch information
vinceAmstoutz authored Dec 30, 2024
1 parent 1a75c17 commit 0cd4d5f
Showing 1 changed file with 26 additions and 0 deletions.
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

0 comments on commit 0cd4d5f

Please sign in to comment.