diff --git a/core/configuration.md b/core/configuration.md index e4a53eaf4ff..2392a9ab225 100644 --- a/core/configuration.md +++ b/core/configuration.md @@ -21,6 +21,9 @@ api_platform: # Specify a name converter to use. name_converter: ~ + # Specify an asset package name to use. + asset_package: null + # Specify a path name generator to use. path_segment_name_generator: 'api_platform.path_segment_name_generator.underscore' diff --git a/core/openapi.md b/core/openapi.md index ffa8d9d3f0d..226e584d12f 100644 --- a/core/openapi.md +++ b/core/openapi.md @@ -402,6 +402,31 @@ swagger_ui: Change `/docs` to the URI you wish Swagger to be accessible on. +## Using a custom Asset Package in Swagger UI + +Sometimes you may want to use a different [Asset Package](https://symfony.com/doc/current/reference/configuration/framework.html#packages) for the Swagger UI. In this way you'll have more fine-grained control over the asset url generations. This is useful i.e. if you want to use different base path, base url or asset versioning strategy. + +Specify a custom asset package name: + +```yaml +# config/packages/api_platform.yaml +api_platform: + asset_package: 'api_platform' +``` + +Set or override asset properties per package: + +```yaml +# config/packages/framework.yaml +framework: + # ... + assets: + base_path: '/custom_base_path' # the default + packages: + api_platform: + base_path: '/' +``` + ## Overriding the UI Template 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: