Skip to content

Commit 7a6c98c

Browse files
authored
feat: add an example on how to define OpenAPI doc server url (#1644)
1 parent cf6e204 commit 7a6c98c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/openapi.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ docker compose exec php \
5050
Symfony allows to [decorate services](https://symfony.com/doc/current/service_container/service_decoration.html), here we
5151
need to decorate `api_platform.openapi.factory`.
5252

53-
In the following example, we will see how to override the title of the Swagger documentation and add a custom filter for
53+
In the following example, we will see how to override the title and the base path URL of the Swagger documentation and add a custom filter for
5454
the `GET` operation of `/foos` path.
5555

5656
```yaml
@@ -95,6 +95,9 @@ class OpenApiFactory implements OpenApiFactoryInterface
9595
$openApi = $openApi->withExtensionProperty('key', 'Custom x-key value');
9696
$openApi = $openApi->withExtensionProperty('x-value', 'Custom x-value value');
9797

98+
// to define base path URL
99+
$openApi = $openApi->withServers([new Model\Server('https://foo.bar')]);
100+
98101
return $openApi;
99102
}
100103
}

0 commit comments

Comments
 (0)