From cc5bc47a0b063bc05269e1b320669cb5dcbf11ce Mon Sep 17 00:00:00 2001 From: Baptiste Lafontaine Date: Mon, 2 Nov 2020 11:21:34 +0100 Subject: [PATCH] Add documentation --- Resources/doc/customization.rst | 19 +++++++++++++++++-- Resources/public/init-swagger-ui.js | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Resources/doc/customization.rst b/Resources/doc/customization.rst index 66d77fb..80d3370 100644 --- a/Resources/doc/customization.rst +++ b/Resources/doc/customization.rst @@ -3,12 +3,11 @@ Customization The look and feel of the Swagger UI can be customized. - Overwrite Twig Template ----------------------- If you want to customize parts of the template, you can create your own Twig template. -This allows to change the title, the header, add additional or replace existing styles or scripts. +This allows to change Swagger UI configuration, page title, page header, add additional or replace existing styles or scripts. Take a look at the Twig documentation `how to extend templates `_. @@ -25,11 +24,27 @@ Just create a file ``templates/bundles/NelmioApiDocBundle/SwaggerUi/index.html.t #} {% extends '@!NelmioApiDoc/SwaggerUi/index.html.twig' %} + {# + Change swagger UI configuration + All parameters are explained on Swagger UI website: + https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/ + #} + {% block swagger_initialization %} + + {% endblock %} + + {# Import your own stylesheet #} {% block stylesheets %} {{ parent() }} {% endblock stylesheets %} + {# Import your own script #} {% block javascripts %} {{ parent() }} diff --git a/Resources/public/init-swagger-ui.js b/Resources/public/init-swagger-ui.js index 8fad535..bb06f3f 100644 --- a/Resources/public/init-swagger-ui.js +++ b/Resources/public/init-swagger-ui.js @@ -49,4 +49,4 @@ function loadSwaggerUI(userOptions = {}) { }; window.ui = ui; -}; +}